Overview
| Artifact ID: | 09bc76134932d4363ff9c25f4ddb541af1140b0e |
|---|---|
| Ticket: | 3536564fffffffffffffffffffffffffffffffff
tcl hangs on parallel execution of commands using open |
| User & Date: | andreas_kupries on 2012-07-18 00:33:04 |
Changes
- closedate changed to: "2012-07-17T17:33:04"
- closer changed to: "andreas_kupries"
- icomment:
Hello Deepanshu. Thank you for providing test scripts. Reviewing them I find fairly big problems in 2.tcl, and the attempted use of fileevents. First, the lines fileevent $imChannel1 readable [set out1 [isProcessDone $imChannel1 $out1]] (and equivalent for channel 2) have the problem that 'isProcessDone' is executed immediately, and not in response to fileevents. Because you are using [...]-quoting which evaluates the command directly. This also means that while you are opening 2 pipes, you are then looking at them sequentially, not in parallel. Further, you are not reconfiguring your channel to be non-blocking, which is strongly recommended when working with fileevents. Otherwise your read/gets in a fileevent handler procedure can block. Making things look like a hang. Then 'isProcessDone' itself accesses the channel in a loop waiting for EOF. With fileevents such a loop would not be necessary, as your handler would get called when EOF is reached, allowing you to test and close, without an explicit loop. Lastly, as you are using tclsh no standard event loop is started (like wish would do), and you are not starting an event loop either (I see no 'vwait' command). With all these problems in the code I currently believe that the source of your problem (hang) is to be found in there, and not in the Tcl core itself. Examples of proper fileevent usage can be found at http://www.activestate.com/blog/2010/05/concurrency-tcl-events-without-getting-twisted http://wiki.tcl.tk/1757 http://www.tcl.tk/man/tcl8.5/tutorial/Tcl40.html - login: "andreas_kupries"
- mimetype: "text/plain"
- priority changed to: "4"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "andreas_kupries"