| Ticket UUID: | 731778 | ||
| Title: | leaking critical sections... | ||
| Type: | Bug | Created on: | 2003-05-03 10:08:29 |
| Submitter: | nobody | Assigned to: | davygrvy |
| Subsystem: | 49. Threading | Severity: | |
| Priority: | 4 | Last modified: | 2004-10-28 03:57:10 |
| Status: | Closed | Closed by: | davygrvy |
| Resolution: | Works For Me | Closed on: | 2004-10-27 20:57:10 |
| Version: | obsolete: 8.4.5 | ||
| Description: | ||||
The following critical sections are never deleted (not even during process detach) via DeleteCriticalSection: from tclWinThrd.c: joinLock initLock masterLock This may not be a complete list, I have not checked the rest of the Tcl/Tk source code. JJM | ||||
| User Comments: | ||||
mistachkin added on 2003-05-03 17:11:10:
Logged In: YES user_id=113501 This should be fixed by deleting the critical sections upon process detach (when the Tcl dll is being unloaded). It will probably have to be done either dead last in the finalization process or darn close to it. mistachkin added on 2003-05-10 15:36:02:
Logged In: YES user_id=113501 JeffH, I can help you fix this issue. I have some ideas that I would like to run by you. hobbs added on 2003-07-17 06:25:27:
Logged In: YES user_id=72656 any update on a patch for these? mistachkin added on 2004-06-24 15:14:23:
Logged In: YES user_id=113501 David, I believe you have fixed this bug? By the way, looking at the code in TclFinalizeLock, are you sure it's safe to delete a critical section that you are currently holding? mistachkin added on 2004-06-24 15:53:21:
Logged In: YES user_id=113501 from MSDN: DeleteCriticalSection "... If a critical section is deleted while it is still owned, the state of the threads waiting for ownership of the deleted critical section is undefined." davygrvy added on 2004-06-24 16:39:59:
Logged In: YES user_id=7549 The change went into the HEAD on 2004-04-22 and the 8.4 branch on 2004-05-05 If deleting an owned CRITICAL_SECTION causes any bad stuff we can change it. I haven't found any bad results from it. Right after this we're a dozen or so calls from hitting ExitProcess or DllMain exiting anyways. I'm not too worried given that I can't find any bad stuff that it causes. I could add a Tcl_MutexUnlock(initLock); before TclFinalizeLock if you want? davygrvy added on 2004-06-25 02:26:38:
Logged In: YES
user_id=7549
How's this?
RCS file: /cvsroot/tcl/tcl/win/tclWinThrd.c,v
retrieving revision 1.31
diff -c -r1.31 tclWinThrd.c
*** tclWinThrd.c22 Jun 2004 13:09:01 -00001.31
--- tclWinThrd.c24 Jun 2004 19:24:27 -0000
***************
*** 435,441 ****
allocOnce = 0;
}
#endif
! /* Destroy the critical section that we are holding. */
DeleteCriticalSection(&initLock);
}
--- 435,442 ----
allocOnce = 0;
}
#endif
! LeaveCriticalSection(&initLock);
! /* Destroy the critical section that we were holding. */
DeleteCriticalSection(&initLock);
}
Just adding a leave before the destroy?
davygrvy added on 2004-10-28 03:57:10:
Logged In: YES user_id=7549 committed to HEAD. | ||||
