Artifacts Associated With Ticket 2269431
Ticket change [db294bf986] (rid 107914) by fomp on 2008-11-12 13:12:46:
- assignee initialized to: "kennykb"
- cmimetype initialized to: "text/plain"
- comment initialized to:
On Windows loading shared objects from a virtual file system, e.g. starkits, leaves temporary files behind after interpreter exits.
- foundin initialized to: "obsolete: 8.5.5"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "fomp"
- subsystem initialized to: "40. Dynamic Loading"
- title initialized to:
load of shared objects leaves temporary files on windows
- type initialized to: "Bug"
Ticket change [e360c32600] (rid 87788) by fomp on 2008-11-12 20:22:56:
- icomment:
The following patch fixes the bug: --- generic/tclLoad.c 7 Oct 2008 20:51:46 -0000 1.16.4.1 +++ generic/tclLoad.c 12 Nov 2008 13:21:09 -0000 @@ -1154,7 +1154,7 @@ if (pkgPtr->fileName[0] != '\0') { Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr; - if ((unLoadProcPtr != NULL) && (pkgPtr->unloadProc != NULL)) { + if (unLoadProcPtr != NULL) { (*unLoadProcPtr)(pkgPtr->loadHandle); } } - login: "fomp"
- mimetype: "text/plain"
- username: "fomp"
- icomment:
Ticket change [3b6fbe4ad2] (rid 112748) by dgp on 2008-11-12 23:22:18:
- assignee changed to: "nijtmans"
- icomment:
There's a battle here with Bug 2059262.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "dgp"
Ticket change [dce0bf59e0] (rid 114562) by nijtmans on 2008-11-13 06:20:12:
- icomment:
The problem here is: how can we know that the dll which is unloaded here doesn't install an exit handler? If it does, it will lead to a crash as soon as the application exists. So, what is worse, a file leak or a crash? The only idea I have now is that in stead of unloading at this point, Tcl could install an exit handler which does the unloading at a later time. However, is the unLoadProc then still available? Ideas welcome. (Does this really have prio 9?)
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [9325bc1179] (rid 105767) by ferrieux on 2008-11-13 14:40:25:
- icomment:
I'm just starting to discover how intricated the finalization hairball is, but I suspect that delaying things is not the solution; indeed, in bug 2270477 we've just seen what happens when an exit handler schedules things for "later"... Now unLoadProc and exitHandler seem a bit in contradiction... I understand that unloading is a rather recent feature, so there are extensions without an unLoadProc, but for those who have both, we could decide than the unLoadProc takes over and automatically de-registers the exitHandler ? Or calls it immediately ?
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [e1d154aecd] (rid 87518) by nijtmans on 2008-11-13 19:05:58:
- icomment:
> I'm just starting to discover how intricated the finalization hairball is, > but I suspect that delaying things is not the solution; indeed, in bug Indeed, thinking more about it, delaying is not the solution: On Windows and HP-UX it is impossible to remove a shared library from the filesystem when it is not unloaded. But I have a better idea now. If the dll is loaded from a VFS file system, then its unloadProc is FSUnloadTempFile (a static function in tclIOUtil.c). So we can simply check for this, and allowing the unload in this situation. That's a much simpler fix, and it prevents muggling with exit handler related things! > an unLoadProc, but for those who have both, we could decide than the > unLoadProc takes over and automatically de-registers the exitHandler ? Or > calls it immediately ? Yes, this is how it should be. But the problematic libraries referred to in [Bug 2059262] don't have any way to de-register or run the exitHandler (believe me, I searched for that before filing 2059262!). Regards, Jan Nijtmans - login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [e2fc3f3c66] (rid 87715) by ferrieux on 2008-11-13 20:24:18:
- icomment:
> But the problematic libraries > referred to in [Bug 2059262] don't have > any way to de-register > or run the exitHandler The idea was not for the library itself to do it, but for the generic Tcl code... Maybe it doesn't make sense, I don't know the details :-} Tell me.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [1f7357581f] (rid 91150) by nijtmans on 2008-11-14 05:46:18:
- icomment:
Checked in the fix, in tclLoad.c 1.21. It just restores the behaviour from before Bugfix 2059262 when the library comes from VFS. If the librarie doesn't come from VFS, nothing changes. It's the most simple solution I can think of. The only dis-advantage is that when the library has no unloadProc, the real unloading from memory is left to the OS. If you don't want this, there is an easy workaround: Just give the library an unLoadProc, even an empty one suffices. This means that ill-behaved libraries still cannot be loaded from VFS: it will lead to a core-dump when the application ends. Lucky enough, I cannot imagine that anyone would like to load Oracle from a starkit: It simply is too dependant on other files installed to be useful. I can live with that limitation. If anyone has a better suggestion, I'm all ears! Still needs to be backported, so leaving open.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [63f357434d] (rid 92671) by nijtmans on 2008-11-14 07:25:05:
- closedate changed to: "2008-11-14T00:25:05"
- closer changed to: "nijtmans"
- icomment:
Backported to core-8-5-branch, so can be closed. If someone has a better idea, feel free to re-open this artifact with (lots of) comments! Regards, Jan Nijtmans - login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "nijtmans"
Ticket change [b5d6fc1d59] (rid 125315) by nijtmans on 2008-11-14 16:15:08:
- icomment:
Created lower-priority follow-up: [ 2282547 ] load of ill-behaved shared library from VFS: core dump
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment: