Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-09-06
20:56 • Closed ticket [1473261fff]: Thread plus 7 other changes artifact: b5d75781c3 user: vasiljevic
2006-04-20
23:53 • Ticket [1473261fff]: 4 changes artifact: 66fa835ea0 user: zoro2
12:02 • Ticket [1473261fff]: 5 changes artifact: a07489c854 user: dgp
05:23 • Ticket [1473261fff]: 4 changes artifact: 27f0fb3789 user: zoro2
05:18 • Ticket [1473261fff]: 4 changes artifact: c20cf4be72 user: zoro2
2006-04-19
21:44 • New ticket [1473261fff]. artifact: 82bac9ede4 user: nobody

Thread

Closed / Wont Fix1473261fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 20 years ago
Descriptionplain2006-04-19 21:44:31
The following code occassionally crashes on Linux/x86 
and 8.4.13 + thread 2.6.3:

package require Thread; set t [thread::create]; thread
::release $t; exit

The following error occurs:
Tcl_Release couldn't find reference for 0x80e0450

Unfortunately GDB stack trace (attached) does not show 
much information.

It happens once each about 20 runs on my machine, it 
may vary though.
zoro2plain2006-04-20 05:18:36
Logged In: YES 
user_id=191529

Did some more testing. This seems to only crash if thread::
release is also called. Tested to work on Linux/x86 and 
Tcl8.4.13+Thread2.6.3 and Tcl8.4.5+Thread2.5.

Also, adding -wait to thread::release does not help. But, 
calling:

package require Thread; set t [thread::create]; thread::
release $t; after 25; exit

Did not throw any exception. So it seems that the thread 
itself needs some time to clean up.
zoro2plain2006-04-20 05:23:17
Logged In: YES 
user_id=191529

Did some more research on Solaris. It seems to also exit 
with an error there, but doing some wait also helps.
dgpplain2006-04-20 12:02:38
Logged In: YES 
user_id=80530


Huh?  The same combination both
works and fails?  Care to start
over?
zoro2plain2006-04-20 23:53:02
Logged In: YES 
user_id=191529

Sorry, forgot to attach the gdb dump:

Starting program: /home/users/tcldev/8413/bin/tclsh8.4 /tmp/
x.tcl
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 631)]
[New Thread 32769 (LWP 632)]
[New Thread 16386 (LWP 633)]
[New Thread 32771 (LWP 634)]
Tcl_Release couldn't find reference for 0x80e0450

Program received signal SIGABRT, Aborted.
[Switching to Thread 32771 (LWP 634)]
0x401ad7c1 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x401ad7c1 in kill () from /lib/libc.so.6
#1  0x40119771 in pthread_kill () from /lib/libpthread.so.0
#2  0x40119a7b in raise () from /lib/libpthread.so.0
#3  0x401ad554 in raise () from /lib/libc.so.6
#4  0x401aea88 in abort () from /lib/libc.so.6
#5  0x400a104a in Tcl_PanicVA (format=0x400d6640 
"Tcl_Release couldn't find reference for 0x%x",
    argList=0xbf5ffa78 
"(D\020@0Ă\f\b\222Ł+@P\004\016\b\230Î\016\b\f") at /home/
users/tcldev/dqkit/src/tcl-8.4.13/generic/tclPanic.c:106
#6  0x400a1080 in Tcl_Panic (arg1=0x400d6640 "Tcl_Release 
couldn't find reference for 0x%x")
    at /home/users/tcldev/dqkit/src/tcl-8.4.13/generic/
tclPanic.c:134
#7  0x400a99cb in Tcl_Release (clientData=0x80e0450) at /
home/users/tcldev/dqkit/src/tcl-8.4.13/generic/tclPreserve.
c:245
#8  0x402ba392 in NewThread () from /home/users/tcldev/8413/
lib/thread2.6.3/libthread2.6.3.so
#9  0x080ece98 in ?? ()
#10 0x0000000c in ?? ()
#11 0x00020000 in ?? ()
#12 0x4010302c in __JCR_LIST__ () from /home/users/tcldev/
8413/lib/libtcl8.4g.so
#13 0x0000000c in ?? ()
#14 0x402c9274 in threadList () from /home/users/tcldev/
8413/lib/thread2.6.3/libthread2.6.3.so
#15 0x4010302c in __JCR_LIST__ () from /home/users/tcldev/
8413/lib/libtcl8.4g.so
#16 0xbf5ffbe0 in ?? ()
#17 0x00000000 in ?? ()
#18 0xbf5ffacc in ?? ()
#19 0x4006e11d in NewThreadProc (clientData=0x1) at /home/
users/tcldev/dqkit/src/tcl-8.4.13/generic/tclEvent.c:1229
Previous frame inner to this frame (corrupt stack?)
vasiljevicplain2006-09-06 20:56:17
Logged In: YES 
user_id=95086

Ah this again....

This is a LONG known problem of the Tcl library 
It is inherently UNSAFE to exit a process while
still having some other threads arround using
the Tcl library. The problem is that invoking 
the exit, the Tcl library will be finalized 
WHILE some other thread potentially still 
makes use of it. 

This cannot be solved without extensive modifications
on how Tcl library is handling teardowns. This is NOT
trivial and I will NOT fix that way until 9.0 Tcl as
this will require numerous changes at various points
and I can't justify that for the 8.x code.
Log in (anonymous is fine) to add a comment.