Skip to content
Tcl Source Code View Ticket
Login

View Ticket

NotifierThreadProc SEGVs on process exit in threaded tcl

Closed / Fixed217952ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:46:32
OriginalBugID: 4005 Bug
Version: 8.2
SubmitDate: '2000-01-11'
LastModified: '2000-05-28'
Severity: SER
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 4199
OS: Solaris
OSVersion: Solaris 5.5.1
Machine: ,UltraSPARC-II
FixedDate: '2000-10-25'
ClosedDate: '2000-05-28'


Name:
Sandeep

CVS:
RCS: @(#) $Id: tclUnixNotfy.c,v 1.5 1999/07/02 06:05:34 welch Exp $

ReproducibleScript:
Race condition in a threaded tcl program which
is processing the "exit" command.

ObservedBehavior:
The main thread is processing a tcl "exit" command and has cleaned 
up the mutexes it has remembered.  See TclFinalizeSynchronization 
in tclThread.c.

At the same time, the thread which is executing NotifierThreadProc 
has not yet completed its execution.  But since the mutexes were
already zeroed out, this thread dies with a SEGV while trying
to do -> Tcl_MutexUnlock(&notifierMutex) .. last line in the function.

Stack trace for main thread 
 [1] Iostream_init::~Iostream_init(0xac5d4, 0x2, 0xeeeedf9c, 0xeeee7518,
0xef7ed820, 0x0), at 0xeeebee54
  [2] __STATIC_DESTRUCTOR(), at 0x213b4
  [3] _fini(0x0, 0xaef38, 0xa997c, 0x0, 0xd6a00, 0xd6a00), at 0x97cc8
  [4] _exithandle(0x0, 0x4, 0xefffe354, 0xa997c, 0xeed952c8, 0x1), at 0xeed179b4
  [5] exit(0x0, 0xc84f0, 0x2, 0xefffe5a0, 0xa997c, 0xc7fc8), at 0xeed74b48
=>[6] EvalObjv(0xc84f0, 0x0, 0x0, 0xde1f2, 0x7, 0x0), at 0x6a44c
  [7] Tcl_EvalEx(0xefffe5a8, 0xde1f2, 0x0, 0xefffe5a0, 0x1, 0xdd7e8), at 0x6ab4c
  [8] Tcl_EvalFile(0xc84f0, 0xefffece8, 0xa997c, 0x0, 0xc7438, 0x1), at 0x600ac
  [9] Tcl_Main(0xb9d7c, 0x0, 0x21260, 0x0, 0xa997c, 0x0), at 0x63690
  [10] main(argc = 2, argv = 0xeffff354), line 127 in "tclAppInit.c"

Stack trace for Notifier Thread
 [1] _mutex_unlock_asm(0x0, 0x1, 0xfffeffff, 0xc3c07, 0xc3c06, 0x0), at
0xeedd40f0
=>[2] _mutex_unlock(0x0, 0x10416710, 0xa997c, 0x0, 0xeea09b90, 0x1), at
0xeedc8064
  [3] NotifierThreadProc(0xbe4c8, 0xb29e4, 0x4, 0xa997c, 0x3, 0x8), at 0x88644

DesiredBehavior:
I dont know the exact fix but I guess the main thread 
should wait for the notifier thread to exit
and then clean out the mutexes/condition wait variables
which were registered.
welch Closed ticket [217952ffff]. [History diff]2000-10-26 08:10:55
Log in (anonymous is fine) to add a comment.