| Ticket UUID: | 1078024 | ||
| Title: | threaded exit can reinit PipeInit on exit and crash | ||
| Type: | Bug | Created on: | 2004-12-03 00:08:10 |
| Submitter: | hobbs | Assigned to: | kennykb |
| Subsystem: | 49. Threading | Severity: | |
| Priority: | 7 High | Last modified: | 2005-11-04 23:01:40 |
| Status: | Closed | Closed by: | kennykb |
| Resolution: | Fixed | Closed on: | 2005-11-04 16:01:40 |
| Version: | obsolete: 8.4.8 | ||
| Description: | ||||
There is an issue with finalization of the threaded Windows build that can appear in winDde.test and occasionally winPipe.test. Kevin narrowed it down to this series of events: * Tcl_Finalize is called from Tcl_Exit and runs all the exit handlers. * After all the exit handlers are run, it winds up calling Tcl_FinalizeThread. * From there we get into Tcl_FinalizeIOSubsystem, and thence to Tcl_Close * We have an open pipe at this point, so we get into PipeClose2Proc from tclWinPipe.c. * This calls Tcl_CleanupChildren -> Tcl_WaitPid * and Tcl_WaitPid finds that the pipe subsystem isn't initialized - because its exit handler has already run, so calls PipeInit, re-establishing the exit handler. * Now we shut down the zippy memory allocator - with the exit handler still on the list. * The last-ditch Tcl_Finalize in DLL_PROCESS_DETACH finds the exit handler and runs it - and then frees the memory. * Which is now in use as a CRITICAL_SECTION down in the C runtime... boom. * I believe that it's a threaded problem only, and the exit handler is being created in Windows-specific code. * I don't know if there's similar code in Unix. This is perhaps related to 990457 (this is unix specific, but about threaded exit behavior) | ||||
| User Comments: | ||||
mistachkin added on 2005-03-04 14:29:40:
Logged In: YES user_id=113501 Argle. I bet this is causing a number of issues I've been seeing on Win32. Unfortunately, I do not know enough about how the IO subsystem is supposed to work. This bug is only loosely related to bug 990457, if at all. This bug is almost certainly related to bug 912571. dgp added on 2005-11-02 00:11:51:
Logged In: YES user_id=80530 Have the finalization fixes since the last comment resolved this one? kennykb added on 2005-11-04 23:01:39:
Logged In: YES user_id=99768 I would presume that it's fixed by my commits of 2005-06-22. The controversial panic in Tcl_Finalize to guard against creating an exit handler after exit handlers have already run should protect us against having this problem recur. | ||||
