View Issue Details

IDProjectCategoryView StatusLast Update
0030377Open CASCADEOCCT:DRAWpublic2019-01-12 14:34
ReporterabvAssigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
OSWindows 
Product Version7.3.0 
Target Version7.4.0Fixed in Version7.4.0 
Summary0030377: DRAW, Windows - command executed via option -c fails on puts
DescriptionIf some command or script executed using DRAW command line option -c contains puts command, it fails on Windows with a message

> can not find channel named "stdout"

In particular, this happens with command testgrid since it uses puts.

The reason is that Tcl creates separate instances of channels for standard streams (stdin, stdout, stderr) for each execution thread. Draw_Interpretor is initialized (during call to ReadInitFile()) for work in separate thread (created by Run_Appli() in Draw_Window.cxx) and contains channels that are created for that thread. When command given with -c option is evaluated from the main thread, Tcl does not find stdout instanced for that thread among the channels registered in the interpretor, so it fails.

To correct this, the command given by -c option should be executed in the appropriate thread (one of tkLoop).
Steps To ReproduceModify draw.bat to add "-c puts AAA" or "-c testgrid demo draw" as arguments to DRAWEXE, when run it
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0029996 closedabv Open CASCADE Porting to VC 2017: memory leak reported in visualisation 
related to 0030430 closedbugmaster Open CASCADE Draw - command testgrid in parallel mode hangs if DRAW is launched without GUI 

Activities

abv

2018-11-19 14:37

manager   ~0081166

Last edited: 2018-11-19 14:49

It is discovered that when OCCT is built with ActiveState build of Tcl (configuration used in Jenkins tests), option -c works well on master.

Note that ActiveTcl behavior seems to be different from that of plain Tcl also for memory, see 0029996:0078253

bugmaster

2018-11-20 11:26

administrator   ~0081171

Built tcl
draw.bat
@echo off

rem Setup environment and launch DRAWEXE
call "%~dp0env.bat" %1 %2 %3

echo Hint: use "pload ALL" command to load standard commands
DRAWEXE.exe -c env.tcl

Launch DRAWEXE with option -c caused error:

C:\OpenCASCADE-7.3.0-vc10-64\opencascade-7.3.0>draw.bat
Hint: use "pload ALL" command to load standard commands
Draw[1]> can not find channel named "stdout"

abv

2019-01-10 10:44

manager   ~0081701

Fix is pushed (together with fix for 0030430) to branch CR30430 and tested, see Jenkins job CR30430-master. Please review.

kgv

2019-01-10 11:26

developer   ~0081705

Please take the patch.

bugmaster

2019-01-10 16:37

administrator   ~0081721

Tested together with 0030430

Related Changesets

occt: master 9b4243f9

2018-11-18 16:53:10

abv


Committer: bugmaster Details Diff
0030377: DRAW, Windows - command executed via option -c fails on puts

When DRAW on Windows is launched with option -c, the command is now properly transferred to Tcl thread (separate thread that runs Tcl interpretor on Windows except when DRAW is run in batch mode) for execution, instead of being evaluated in the main thread.

Execution of DRAW in batch mode (option -b) is fixed by enabling proper initialization of the Tcl interpretor and replacement of backslashes in path to startup script by straight slashes on Windows in that mode.

Declaration of global variables used for communication of console command between threads is moved to Draw_Window.hxx to ensure consistency.
Function wscpy_s is used instead of memcpy to avoid possible buffer overrun.
Affected Issues
0030377
mod - src/Draw/CommandWindow.cxx Diff File
mod - src/Draw/Draw.cxx Diff File
mod - src/Draw/Draw_Window.cxx Diff File
mod - src/Draw/Draw_Window.hxx Diff File

Issue History

Date Modified Username Field Change
2018-11-16 07:30 abv New Issue
2018-11-16 07:30 abv Assigned To => apn
2018-11-19 14:37 abv Note Added: 0081166
2018-11-19 14:49 abv Note Edited: 0081166
2018-11-19 14:50 abv Relationship added related to 0029996
2018-11-20 11:26 bugmaster Note Added: 0081171
2018-11-20 11:37 bugmaster Assigned To apn => abv
2019-01-10 10:41 abv Relationship added related to 0030430
2019-01-10 10:44 abv Note Added: 0081701
2019-01-10 10:44 abv Assigned To abv => kgv
2019-01-10 10:44 abv Status new => resolved
2019-01-10 11:26 kgv Note Added: 0081705
2019-01-10 11:26 kgv Assigned To kgv => bugmaster
2019-01-10 11:26 kgv Status resolved => reviewed
2019-01-10 11:26 kgv Product Version => 7.3.0
2019-01-10 16:36 bugmaster Test case number => Not needed
2019-01-10 16:37 bugmaster Note Added: 0081721
2019-01-10 16:37 bugmaster Status reviewed => tested
2019-01-12 14:34 bugmaster Changeset attached => occt master 9b4243f9
2019-01-12 14:34 bugmaster Status tested => verified
2019-01-12 14:34 bugmaster Resolution open => fixed