Tcl Source Code

View Ticket
Login
Ticket UUID: 219006
Title: tcl with threads will not exit
Type: Bug Created on: 2000-10-26 01:09:14
Submitter: nobody Assigned to: nobody
Subsystem: 49. Threading Severity:
Priority: 2 Last modified: 2000-10-26 08:33:08
Status: Closed Closed by: welch
Resolution: Fixed Closed on: 2000-10-26 01:33:08
Version: obsolete: 8.2
Description:
OriginalBugID: 3871 Bug
Version: 8.2
SubmitDate: '1999-12-13'
LastModified: '2000-04-25'
Severity: CRIT
Status: Released
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 3414 4139
OS: Solaris
OSVersion: Solaris 2.5.1 , 2.6 , 2.7
FixedDate: '2000-04-25'
FixedInVersion: 8.3.1
ClosedDate: '2000-10-25'


Name:
Amit Khivesara

ReproducibleScript:
In a tcl program if we do a ::system("") command which
starts a child which is run in the background.
e.g .::system("tail -f /etc/passwd&").

The program will not exit since the Notify Thread will not come out of the select in tclUnixNotify.c

ObservedBehavior:
This is because the pipe is closed by the other thread
but the fork of the child in ::system still has the file
descripter open.

DesiredBehavior:
It should exit.

PatchFiles:
The bug is in tclUnixNotify.c in method NotifierThreadProc.
    The fds should be FD_CLOEXEC.

    i.e. 
       if (pipe(fds) != 0) {
        panic("NotifierThreadProc: could not create trigger pipe.");
        }
    /** Lines added are for BUG!!!*/
        fcntl(fds[0],F_SETFD,FD_CLOEXEC);
        fcntl(fds[1],F_SETFD,FD_CLOEXEC);



This is the same problem as was noted in 4139, fixed with different
fix (sending 'q' through triggerPipe). 
-- 04/25/2000 hobbs