Skip to content
Tcl Source Code View Ticket
Login

View Ticket

application hangs on non-blocking command channel

Closed / Fixed218588ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:02:47
OriginalBugID: 1356 Bug
Version: 8.0.3
SubmitDate: '1999-03-02'
LastModified: '1999-12-03'
Severity: CRIT
Status: Released
Submitter: pat
ChangedBy: hobbs
RelatedBugIDs: 710
OS: Solaris
OSVersion: 2.5.1
Machine: Other
FixedDate: '1999-12-03'
FixedInVersion: 8.2.3
ClosedDate: '2000-10-25'


Name: Jean M. Brouwers

ObservedBehavior:
After opening a command channel and after setting the channel option to non-blocking, the application hangs, occasionally.  It turns out that system call waitpid() is being called with the options argument set to 0 and not WNOHANG.

The call stack shows that waitpid() is called from
TclCleanupChildren (in tclPipe.c), which is called by
PipeCloseProc (in tclUnixPipe.c),
CloseChannel (in tclIO.c),
FlushChannel (intclIO.c), and ultimately
Tcl_Close (in tclIO.c)

DesiredBehavior:
Tcl_Close should not be waiting for any child processes to finish if the command channel option is non-blocking.

Closer inspection of the source code shows that PipeCloseProc does include the correct handling of this situation if flag isNonBlocking of the PipeState is set to non-zero.  However, that flag is never set to anything else than zero.



Proposed remedy:  function PipeBlockModeProc (in tclUnixPipe.c) should set the flag isNonBlcoking correctly depending on the value of the mode argument passed in.
---
Adding
    psPtr->isNonBlocking = (mode == TCL_MODE_NONBLOCKING);
before the return in unix/tclUnixPipe.c:PipeBlockModeProc
seems to solve the problem. 
-- 11/29/1999 hobbs
welch Closed ticket [218588ffff]. [History diff]2000-10-26 08:25:09
dgp Ticket [218588ffff]: 3 changes [History diff]2001-04-05 08:20:13
Log in (anonymous is fine) to add a comment.