Overview
| Artifact ID: | 6601f6714fe6eb4db508b24d77aaa13aab7459b6 |
|---|---|
| Ticket: | 486399ffffffffffffffffffffffffffffffffff
Panic on exit before all threads returned |
| User & Date: | andreas_kupries on 2002-01-12 04:33:08 |
Changes
- icomment:
Logged In: YES user_id=75003 I am not satisified with the proposed solution of using TclInExit (as public API) to avoid the problem. Threads are usual unwound (thread::unwind) from nested event loops and can process arbitrary commands before actually exiting. This means that this code may use any global subsystem of the tcl-library, including the Preserve-subsystem, and not only by calling Tcl_Release, but Tcl_Preserve as well. As all these global susbsystems are effectively already shutdown anything may happen, most likely crashes in other places. And TclInExit will tide us over these only so far. The main problem I see exposed through this bug is IMHO that the main thread is special. Shutting down a thread created by the Thread package finalizes this thread and all data pertaining to it. But shutting down the main thread additionally finalizes all global information shared across all the existing threads, thus rendering all other threads unable to run. So, what possible solutions do we have to this ? 1) Have the thread package register a global exit handler. As these are called before everything else this will allow the thread package to simply kill all threads still running (This would also be the approved and public method of getting the information that we are in exiting the process). The downside would be that the killed threads may not have completed their actions. In the specific case of this bug it would be most likely that the logger thread is killed and unable to print the log messages of the last- closing worker-thread. But this is something which can be worked around. 2) Find a way to block the finalization of the main thread and global information until after all the other threads are finalized. The downside is that an improperly coded application may simply hang on exit because of one or more threads not shutting down, or not shut down. Of the solutions above I prefer the first one as its downside is less troubling than the downside of the second to me. If someone else sees other solutions I would be happy to hear about them.
- login: "andreas_kupries"
- mimetype: "text/plain"
- priority changed to: "7 High"
- username: "andreas_kupries"