MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0030430Open CASCADE[OCCT] OCCT:DRAWpublic2019-01-03 12:352019-01-12 14:42
Reporterabv 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusverifiedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 7.3.0 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0030430: Draw - command testgrid in parallel mode hangs if DRAW is launched without GUI
DescriptionIt is impossible to run testgrid command in parallel mode using DRAW option -f (or -c): it just hangs.

The problem has been identified after fix of 0030377, however it does exist in all versions of OCCT that I have tried (6.8.0 till current), and for all tested versions of Tcl (including ActiveTcl 8.6, standard Tcl 8.6.4, 8.6.8, 8.7.0a - all built from sources).

The symptoms are as follows.

1. The test script succeeds in creating thread pool and setting up jobs, and hangs on waiting for jobs to complete. If job script is replaced by some Tcl command instead of exec (e.g. puts), it works fine. The jobs hangs only when it contains "exec" command, and does hang regardless of what executable is used (I have tried "git status" - just the same as executed successfully in the beginning of the testgrid command, and it hangs in the same way as DRAWEXE).

2. Under debugger, the execution successfully goes to creation of the process (in tclWinPipe.c, function TclpCreateProcess()): CreateProcess returns non-zero and yields some non-zero PID. The program then waits infinitely in

3. If non-existing command is fed to exec instead of DRAWEXE, the jobs complete correctly (all tests fail) but execution hangs in tpool::release again waiting for some events (threadPoolCmd.c, function TpoolRelease())

4. Testgrid works OK if Tk_Init() is called (it is called when DRAW is executed interactively but not with -c or -f options -- in that case it sets variable Draw_VirtualWindows to true an skips initialization of Tk). If DRAW is built without Tk at all, testgrid hangs in the same way.

In Tk_Init(), the crucial point looks to be the call to TkListCreateFrame(): if it is bypassed (in debugger), the hang up is reproduced.

5. Testgrid works OK if DRAW runs in batch mode, i.e. without creation of separate thread for evaluation of Tcl commands. That mode can be enabled by option -b, but requires patch for 0030377 to work.
Steps To Reproduce1. Create file "testgrid.tcl" containing single line "testgrid demo draw -overwrite"

2. Modify draw.bat adding arguments to DRAWEXE:

DRAWEXE -f path/to/testgrid.tcl

3. Launch draw.bat
TagsNo tags attached.
Test case numberdemo/draw/bug30430
Attached Files? file icon bug30430.tcl (1,006 bytes) 2019-01-07 13:12

- Relationships
related to 0030377verifiedbugmaster DRAW, Windows - command executed via option -c fails on puts 

-  Notes
(0081685)
abv (manager)
2019-01-07 13:15

Attached script bug30430.tcl demonstrates the problem (the same or very similar) without any OCCT-specific commands, using pure Tcl code. It works fine in Tcl shell (tclsh.exe bug30340.tcl) or in DRAW if launched in interactive mode (with option -i), but hangs on releasing thread pools if DRAW is executed without TK (non-interactive mode, virtual windows).
(0081700)
git (administrator)
2019-01-10 08:20

Branch CR30430 has been created by abv.

SHA-1: b727d25e54c44a99efb9aa2c15236ef8c36b9f92


Detailed log of new commits:

Author: abv
Date: Thu Jan 10 08:17:04 2019 +0300

    0030430: Draw - command testgrid in parallel mode hangs if DRAW is launched without GUI
    
    Ensure that initialization of Tcl interpretor is performed in the same thread where commands are evaluated.
    
    Added test demo draw bug30430

Author: abv
Date: Sun Nov 18 19:53:10 2018 +0300

    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.
(0081702)
abv (manager)
2019-01-10 10:44

Fix is pushed (together with fix for 0030377) to branch CR30430 and tested, see Jenkins job CR30430-master. Please review.
(0081706)
kgv (developer)
2019-01-10 11:28

Please take the patch.
(0081720)
bugmaster (administrator)
2019-01-10 16:36

Combination -
OCCT branch : CR30430 SHA - b727d25e54c44a99efb9aa2c15236ef8c36b9f92
Products branch : master SHA - 0b9df64a156abd5cbfbfccb15967b46cdabfe1f8
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16384.390000000094 / 16363.880000000001 [+0.13%]
Products
Total CPU difference: 7178.450000000044 / 7172.62000000003 [+0.08%]
Windows-64-VC14:
OCCT
Total CPU difference: 17734.359375 / 17727.875 [+0.04%]
Products
Total CPU difference: 8593.5625 / 8592.53125 [+0.01%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0081765)
git (administrator)
2019-01-12 14:42

Branch CR30430 has been deleted by inv.

SHA-1: b727d25e54c44a99efb9aa2c15236ef8c36b9f92

- Related Changesets
occt: master 8de8dacd
Timestamp: 2019-01-10 05:17:04
Author: abv
Committer: bugmaster
Details ] Diff ]
0030430: Draw - command testgrid in parallel mode hangs if DRAW is launched without GUI

Ensure that initialization of Tcl interpretor is performed in the same thread where commands are evaluated.

Added test demo draw bug30430
mod - src/Draw/Draw_Interpretor.cxx Diff ] File ]
mod - src/Draw/Draw_Window.cxx Diff ] File ]
add - tests/demo/draw/bug30430 Diff ] File ]

- Issue History
Date Modified Username Field Change
2019-01-03 12:35 abv New Issue
2019-01-03 12:35 abv Assigned To => abv
2019-01-04 00:38 abv Description Updated View Revisions
2019-01-07 13:12 abv File Added: bug30430.tcl
2019-01-07 13:15 abv Note Added: 0081685
2019-01-08 21:31 abv Description Updated View Revisions
2019-01-10 08:20 git Note Added: 0081700
2019-01-10 10:41 abv Relationship added related to 0030377
2019-01-10 10:44 abv Note Added: 0081702
2019-01-10 10:44 abv Assigned To abv => kgv
2019-01-10 10:44 abv Status new => resolved
2019-01-10 11:28 kgv Note Added: 0081706
2019-01-10 11:28 kgv Assigned To kgv => bugmaster
2019-01-10 11:28 kgv Status resolved => reviewed
2019-01-10 11:28 kgv Product Version => 7.3.0
2019-01-10 16:32 bugmaster Test case number => demo/draw/bug30430
2019-01-10 16:36 bugmaster Note Added: 0081720
2019-01-10 16:36 bugmaster Status reviewed => tested
2019-01-12 14:34 bugmaster Changeset attached => occt master 8de8dacd
2019-01-12 14:34 bugmaster Status tested => verified
2019-01-12 14:34 bugmaster Resolution open => fixed
2019-01-12 14:42 git Note Added: 0081765


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker