Tcl Source Code

View Ticket
Login
Ticket UUID: 219045
Title: Core dumps on SIGINT in multithreaded application after retu
Type: Bug Created on: 2000-10-26 01:09:51
Submitter: nobody Assigned to: nobody
Subsystem: 49. Threading Severity:
Priority: 2 Last modified: 2000-10-26 08:34:05
Status: Closed Closed by: welch
Resolution: Fixed Closed on: 2000-10-26 01:34:05
Version: final: 8.2.3
Description:
OriginalBugID: 4112 Bug
Version: 8.2.3
SubmitDate: '2000-02-01'
LastModified: '2000-02-07'
Severity: CRIT
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
OSVersion: Solaris 2.7
Machine: Sun Ultra 30
FixedDate: '2000-02-07'
FixedInVersion: 8.3b1
ClosedDate: '2000-10-25'


Name:
Stephan Voges

CustomShell:
We redefine the "puts" command.

ObservedBehavior:
We use Tcl 8.2.3 in a multithreaded application.  This application installs its own handler for SIGINT.  We observe that if the script contains an "exec" command, any Ctrl-C after the "exec" will cause a core dump.  Searching for the string "SIGINT" through the Tcl source, we found that in the file tclUnixPipe.c, there is a function RestoreSignals that sets the handler for SIGINT back to default.  If we modify this code to set it to our handler, the problem goes away.  We also noticed that RestoreSignals is called in a process spawned by vfork, which according to the man pages is not MT-safe.

DesiredBehavior:
Tcl shouldn't change our signal handlers.  If it needs to temporarily, or if something else might, it should save state and restore state afterwards.

Patch:
Diff output: note that this was just a hack, we declared our handler 
30a31
>  extern void my_handler (int sig);
493c494
<     signal(SIGINT, SIG_DFL);
---
>     signal(SIGINT, my_handler);

PatchFiles:
tclUnixPipe.c



This should be solved in 8.3, where we no longer attempt to use
vfork at all due to reasons like the above.  Please tell us if
that doesn't fix this particular case (it did solve other signal
related issues with vfork). 
-- 02/05/2000 hobbs
User verified that 8.3b2 works as expected. 
-- 02/07/2000 hobbs