Artifacts Associated With Ticket 597575ffffffffffffffffffffffffffffffffff
Ticket change [87b245fa33] (rid 131741) by andreas_kupries on 2002-08-20 02:47:32:
- assignee initialized to: "vasiljevic"
- cmimetype initialized to: "text/plain"
- comment initialized to:
When executing the script below the tcl interpreter may crash every once in a while (I usually have to execute it once or twice for the problem to happen). ----------------- package require Thread puts [info loaded] puts [pwd] set t [::thread::create] after 5000 "::thread::send $t exit" ----------------- Basically the interpreter is shutdown from inside the created thread, and not the main-thread, and the main thread is running an after. Timing-depending, it seems that the exit killed the Tcl_Release-data structure before the after in the main thread is completely done with its interpreter, causing it to try to release the structure with nothing being there anymore. Stack trace: attached, to prevent it from taking up space in the notification mails.
- foundin initialized to: "None"
- priority initialized to: "8"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "andreas_kupries"
- subsystem initialized to: "49. Threading"
- title initialized to: "[exit] in sub-thread may crash."
- type initialized to: "Bug"
Add attachment "st" [231ab9441f] (rid 130860) by andreas_kupries on 2002-08-20 09:47:32.
Ticket change [8d73f0c0e9] (rid 127937) by andreas_kupries on 2002-08-20 09:47:33:
- icomment:
File Added - 29400: st
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [906d020388] (rid 120450) by andreas_kupries on 2002-08-20 09:51:05:
- icomment:
Logged In: YES user_id=75003 I forgot that the script contains a 'vwait forever' to wait for the after.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [2ef87e68aa] (rid 92974) by andreas_kupries on 2002-08-20 10:00:55:
- icomment:
Logged In: YES user_id=75003 Guess I should also note that I consider this problem ... diificult ... to fix, expecially with the current system for finalizing things. Because of this I am absolutely willing to live with the problem, if this is properly documented, like below, or similar. In a threaded environment the main thread of a script, i.e. the thread created together with the tcl process is special. Do not exit the application from one of the threads created by the script. alsways use the main thread for this, and only after all sub-threads have exited. Otherwise crashes may occur during process tear-down.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [35a122c6bf] (rid 106971) by dgp on 2002-08-20 21:48:29:
- icomment:
Logged In: YES user_id=80530 Would it a reasonable solution to not define [exit] in interps that are in threads other than the main one? Or perhaps to define [exit] in those threads to something that deletes the interp, and/or exits the thread?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [b3448f8732] (rid 98502) by vasiljevic on 2002-08-20 23:55:48:
- icomment:
Logged In: YES user_id=95086 Please visit the: Bug ID: 486399 Category 80. Thread package We did already discussed this matter. but never really got to a solution. As AK says, if properly documented, one should be able to live with this. Otherwise, we must revise the finalization stuff and add some reference counting and things like that. Zoran
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [acb50700a2] (rid 101342) by andreas_kupries on 2002-08-21 00:00:02:
- icomment:
Logged In: YES user_id=75003 Ah. Thanks. I was wondering if we had that encountered before, but was not sure. I guess we can close this as a duplicate then.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [6f21452253] (rid 100260) by dgp on 2002-08-21 00:02:46:
- icomment:
Logged In: YES user_id=80530 I don't know anything about the details involved here, but the issue seems similar in spirit to me to the problem of [exit] in a slave interp http://mini.net/tcl/894 The solution that feels right to me is that [exit] should have appropriate behavior for the context it is in. In a master interp, ok exit the application, but in a slave, just destroy that one interp. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [e748f308da] (rid 104430) by hobbs on 2003-02-22 01:57:00:
- icomment:
Logged In: YES user_id=72656 Zoran - what is the status of this one?
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [83ba1098c8] (rid 117430) by vasiljevic on 2003-02-22 15:59:02:
- icomment:
Logged In: YES user_id=95086 Pending. As AK (se below) correctly stated, this one is pretty difficult to solve. We ought to change the way the core is finalizing various subsytems. We'd need to introduce refcounts on those subsystems and do the tear down on the last-thread exit. Now, they are finalized on the main-thread exit which obviously affects other thread in the process still using the Tcl library. I'd say, that this should still be left open, as a reminder. I also think that in the process of the Tcl Thread API revamp (which we (I) should do) this issue might be addressed.
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [242f964a1b] (rid 131071) by dgp on 2003-11-13 08:07:37:
- foundin changed to: "obsolete: 8.4.4"
Ticket change [52b9edb1dd] (rid 126366) by dgp on 2006-03-10 11:37:26:
- icomment:
Logged In: YES user_id=80530 There's been a lot of changes in Tcl's finalization sequence in the last 3 years. Any chance some of those changes fixed this bug?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8f9f9e3caf] (rid 120309) by vasiljevic on 2006-03-10 20:03:48:
- icomment:
Logged In: YES user_id=95086 No chances. Please look at the comment I just added to Bug #486399.
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [a17d584a05] (rid 109720) by georgeps on 2008-08-15 10:23:03:
- icomment:
Logged In: YES user_id=585068 Originator: NO bug report 2001201 has a patch to fix this. "We ought to change the way the core is finalizing various subsytems. We'd need to introduce refcounts on those subsystems and do the tear down on the last-thread exit." Why would we need that to fix the Tcl_Exit problem? Why not just remove the full Tcl_Finalize from Tcl_Exit, as the patch associated with 2001201 does? I agree we need the reference count solution if we want Tcl_Finalize to work in the multiple-Tcl-thread case, which it doesn't currently, but I don't know if that's reasonable or doable when Tcl_Finalize cleans up global state for all Tcl threads, and 1 or more of the threads that are not calling Tcl_Finalize may be in unknown states. It seems simpler and more maintainable to just have threads join/exit and cleanup via Tcl_Finalize when all other threads have exited.
- login: "georgeps"
- mimetype: "text/plain"
- username: "georgeps"
- icomment:
Ticket change [9ba9f7b16b] (rid 111167) by ferrieux on 2009-06-16 04:54:42:
- icomment:
I strongly suspect this is a dup of 2001201 indeed. Please review George's updated patch there.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [aa77a291fa] (rid 100933) by ferrieux on 2009-06-18 03:02:59:
- icomment:
Since the patch in 2001201 has been applied, please test.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [1b21f5a037] (rid 123094) by dkf on 2009-06-18 15:18:23:
- assignee changed to: "ferrieux"
- closedate changed to: "2009-06-18T08:18:23"
- closer changed to: "dkf"
- icomment:
allow_comments - 1 Works with HEAD when I test with repeated runs of this line... echo 'load /System/Library/Tcl/thread2.6/libthread2.6.dylib;set t [::thread::create]; puts [info patch],[info loaded],[package require Thread],$t;after 2000 "puts sending...;thread::send $t exit"; vwait forever' | make -C unix shell Looks to me like you and GPS have nailed it. Great!
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"