Tcl Source Code

View Ticket
Login
Ticket UUID: 219346
Title: Multi-threaded app forks and hangs when threads exit.
Type: Bug Created on: 2000-10-26 05:11:04
Submitter: nobody Assigned to: nobody
Subsystem: 49. Threading Severity:
Priority: 5 Medium Last modified: 2002-03-23 04:56:46
Status: Closed Closed by: hobbs
Resolution: None Closed on: 2002-03-22 21:56:46
Version: obsolete: 8.3.1
Description:
OriginalBugID: 5539 Bug
Version: 8.3.1
SubmitDate: '2000-05-16'
LastModified: '2000-10-25'
Severity: CRIT
Status: UnAssn
Submitter: techsupp
OS: Solaris
OSVersion: Solaris 2.5.1
Machine: A Sun Ultra 2 Creator 2 Series 1300, 384 MB of RAM, 8 GB of hard
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
George Fievet

Extensions:
No extensions

CustomShell:
No modifications, no patches, no definitions

Comments:
The reason we were attempting this upgrade is that we were looking for
    increased reliabiltiy with exec calls and multi-threaded programs, since
    we have had some trouble with that in the past.

ObservedBehavior:
We have written a C++ program that holds up to 25 embedded Tcl scripts (Tcl_CreateInterp).  These scripts are used to connect to and communicate with the terminal interface on telephone switches.  When these scripts fail to connect, they are designed to wait a certain amount of time and then try again.  This worked find under Tcl 8.3.0.  We decided to upgrade to Tcl 8.3.1.  In this case, whenever a Tcl script attempts to restart after an initial failure, the process containing the scripts spawns a child and that child freezes.  This happened for each of the threads in the process.

Here is the ps listing for this process (dsis).  ID 16244 is the original.
orwell# ps -ef | grep dsis | more
    root 20759 16244  0 16:25:55 ?        0:00 dsis
    root 20663 16244  0 16:25:37 ?        0:00 dsis
    root 20894 16244  0 16:26:13 ?        0:00 dsis
    root 21019 16244  0 16:26:33 ?        0:00 dsis
    root  5371  4435  0 17:14:25 pts/10   0:00 grep dsis
    root 21098 16244  0 16:26:49 ?        0:00 dsis
    root 21011 16244  0 16:26:31 ?        0:00 dsis
    root 20753 16244  0 16:25:53 ?        0:00 dsis
    root 20662 16244  0 16:25:36 ?        0:00 dsis
    root 21081 16244  0 16:26:44 ?        0:00 dsis
    root 16244     1  6 16:04:54 ?        4:30 dsis
    root 20664 16244  0 16:25:37 ?        0:00 dsis
    root 21090 16244  0 16:26:47 ?        0:00 dsis
    root 21076 16244  0 16:26:43 ?        0:00 dsis
    root 20898 16244  0 16:26:13 ?        0:00 dsis
    root 20895 16244  0 16:26:13 ?        0:00 dsis
    root 20744 16244  0 16:25:52 ?        0:00 dsis
    root 20893 16244  0 16:26:12 ?        0:00 dsis
    root 20755 16244  0 16:25:54 ?        0:00 dsis
    root 20767 16244  0 16:25:57 ?        0:00 dsis
    root 20655 16244  0 16:25:35 ?        0:00 dsis
    root 20900 16244  0 16:26:14 ?        0:00 dsis                             
    root 21079 16244  0 16:26:44 ?        0:00 dsis
    root 21086 16244  0 16:26:45 ?        0:00 dsis                            

Here is the stack trace for one of the processes that froze.
orwell# /usr/proc/bin/pstack 21086
 21086: dsis
 ef4b6a64 sigtimedwait (e5c06c2c, 0, 0)
 ef4b6a64 _libc_sigtimedwait (e5c06c2c, 0, 0, ef67acc8, 2, e5c07e3c) + 4
 ef6587b8 _panic   (0, ef514db4, 1, 0, 0, e5c06c3c) + 158
 ef657448 _alloc_chunk (0, 810000, e5c06f94, e5c07e4b, 0, ffffffff) + 38
 ef657050 _alloc_stack (102000, e5c06f94, 0, ef6736d0, 0, 0) + d8
 ef65d84c _alloc_thread (1, 100000, e5c06fb4, 1, ef67b338, ef67b368) + bc
 ef659610 _reaper_create (1c3e10, ef676558, e5c07e4a, ef67aca8, ef676558, 1c3e10
) + 1c
 ef65f9cc _ti_fork1 (ef673880, ef676938, ef673650, ef67ac88, ef6736d0, 0) + 130
 ef5f9740 TclpCreateProcess (394350, 3, 5e0e18, 1, 8c, 3) + e8
 ef5e3330 TclCreatePipeline (394350, 3, 5e0e18, 1, 0, e5c07224) + 774
 ef5e3600 Tcl_OpenCommandChannel (394350, 5, 5e0e18, 0, 26, 50e090) + 60
 ef5d52cc Tcl_ExecObjCmd (5, 394350, 5, e5c07538, ef5d5158, e5c074a0) + 174
 ef5dfa24 EvalObjv (394350, 7, e5c07538, 49dbbf, 24, 0) + 338
 ef5e0068 Tcl_EvalEx (394350, 49dbbf, 0, e5c076b0, 24, 0) + 108
 ef5dfd48 Tcl_EvalTokens (0, e5c078e8, 1, e5c078d8, e5c07860, 0) + ac
 ef5e001c Tcl_EvalEx (0, 4994c8, 0, e5c078d8, 4876, 0) + bc
 ef5d65d4 Tcl_EvalFile (394350, 4e34dc, 0, 25, 6c, 4e34ee) + 134
 00045100 __0FTDSISCreateNewInterpPv (4df080, 0, e5c07e4a, e5c07e4b, 0, e5c07e49
) + 5c0
 ef662714 _thread_start (4df080, 0, 0, 0, 0, 0) + 34

DesiredBehavior:
We expect that the threads will continue to be created, fail to connect, exit, and then try again until the failure limit is reached.  This worked just fine in Tcl 8.3.0 and 8.2.2.  The only change was the upgrade to 8.3.1.
User Comments:
hobbs added on 2001-10-17 05:41:24:
Logged In: YES 
user_id=72656

This needs to be reverified with a newer version of Tcl.

hobbs added on 2002-03-23 04:56:46:
Logged In: YES 
user_id=72656

Again, without more info we can't do much.