Artifacts Associated With Ticket 2931244
Ticket change [6f6f3ed3a2] (rid 100317) by azaroo on 2010-01-13 09:27:32:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
This does not happen on tcl8.5.7. Please see the attached testcase. just start tclsh % package require testPackage % exit And the crash occurs.
- foundin initialized to: "obsolete: 8.5.8"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "azaroo"
- subsystem initialized to: "10. Objects"
- title initialized to: "TCL 8.5.8 crashes on exit"
- type initialized to: "Bug"
Add attachment "tclCrash858.tgz" [d66f87fee6] (rid 123805) by azaroo on 2010-01-13 16:27:35.
Ticket change [4fccd84c80] (rid 125885) by azaroo on 2010-01-13 16:27:35:
- icomment:
File Added - 358788: tclCrash858.tgz
- login: "azaroo"
- mimetype: "text/plain"
- username: "azaroo"
- icomment:
Ticket change [57ab6f38a9] (rid 117658) by ferrieux on 2010-01-13 18:16:02:
- icomment:
A bit of human-readable context would be appreciated. Basically you need a specific behavior from an extension to crash. Please summarize it.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [461f54326d] (rid 99470) by azaroo on 2010-01-13 18:31:57:
- icomment:
I am not good at it, but let me try! 1. You need to compile the cpp file into a dll and modify the pkgIndex.tcl file accordingly to load the package. 2. The tclsh was compiled without threads. The Crash Happens in the destructor ~TclFileHandles() { Tcl_UnregisterChannel(0, chann); Tcl_FSDeleteFile(channFileName); Tcl_DecrRefCount(channFileName); if (fp) { // hack as mentioned above fclose(fp); unlink(fpFileName.c_str()); } } on Tcl_DecrRefCount(channFileName); In a debugger, I could track it down to TclFreeObj function call where this problem was manifesting itself. If you want some other info do let me know! Regards, - login: "azaroo"
- mimetype: "text/plain"
- username: "azaroo"
- icomment:
Ticket change [635d7caaf3] (rid 92563) by ferrieux on 2010-01-13 21:12:33:
- icomment:
Uh, what I don't see is the link between the Tcl/extension API (XXX_Init and XXX_unload) and your C++ class's constructor and destructor. Maybe a file is missing ? Otherwise, how do you ensure that the constructor is called by Test_Init and (more importantly) the destructor by Test_Unload ?
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [92a07a9f24] (rid 120794) by azaroo on 2010-01-13 21:52:04:
- icomment:
Ok! Basically the load library call loads the dll and that is all is required. The Test_Init is just a stub and does not do anything. The Constructor is called as there are static members and the destructor will be called on unload of the dll. I hope that is it.
- login: "azaroo"
- mimetype: "text/plain"
- username: "azaroo"
- icomment:
Ticket change [9492997e1b] (rid 106009) by ferrieux on 2010-01-13 22:57:02:
- icomment:
OK so you destructor gets called by dlclose(), hence by TclFinalizeLoad, which is very late in the Tcl_Finalize sequence, notably *after* TclFinalizeObjects. Hence you shouldn't do any Tcl_Obj freeing, nor anything Tcl-oriented for that matter, in the destructor. Just do things that are related to (1) the outside side-effects of your extensions (created files or shared memory segments mainly), and (2) optionally private mallocs, and only if you want to use a vlagrind-like tool to hunt leaks. All the rest is guaranteed to be properly nuked by the normal finalization process.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [79dae0ce8c] (rid 90202) by ferrieux on 2010-01-13 22:57:03:
- closedate changed to: "2010-01-13T15:57:03"
- closer changed to: "ferrieux"
- resolution changed to: "Invalid"
- status changed to: "Closed"