|
2008-11-14
| ||
| 16:15 | • Ticket [2269431fff] load of shared objects leaves temporary files on windows... artifact: b5d6fc1d59 user: nijtmans | |
| 09:04 | • New ticket [2282547fff] load of ill-behaved shared library from VFS: core dump</... artifact: 67d2370919 user: nijtmans | |
| 07:25 | • Closed ticket [2269431fff]: load of shared objects leaves temporary files on win... artifact: 63f357434d user: nijtmans | |
| 05:46 | • Ticket [2269431fff]: 4 changes artifact: 1f7357581f user: nijtmans | |
|
2008-11-13
| ||
| 20:24 | • Ticket [2269431fff]: 4 changes artifact: e2fc3f3c66 user: ferrieux | |
| 19:05 | • Ticket [2269431fff]: 4 changes artifact: e1d154aecd user: nijtmans | |
| 14:40 | • Ticket [2269431fff]: 4 changes artifact: 9325bc1179 user: ferrieux | |
| 06:20 | • Ticket [2269431fff]: 4 changes artifact: dce0bf59e0 user: nijtmans | |
|
2008-11-12
| ||
| 23:22 | • Ticket [2269431fff]: 6 changes artifact: 3b6fbe4ad2 user: dgp | |
| 20:22 | • Ticket [2269431fff]: 4 changes artifact: e360c32600 user: fomp | |
| 13:12 | • New ticket [2269431fff]. artifact: db294bf986 user: fomp | |
load of shared objects leaves temporary files on windows
Closed / Fixed2269431fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-11-12 13:12:46
On Windows loading shared objects from a virtual file system, e.g. starkits, leaves temporary files behind after interpreter exits.
fompplain2008-11-12 20:22:56
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);
}
}
dgpplain2008-11-12 23:22:18
There's a battle here with Bug 2059262.
nijtmansplain2008-11-13 06:20:12
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?)
ferrieuxplain2008-11-13 14:40:25
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 ?
nijtmansplain2008-11-13 19:05:58
> 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
ferrieuxplain2008-11-13 20:24:18
> 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.
nijtmansplain2008-11-14 05:46:18
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.
nijtmansplain2008-11-14 07:25:05
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
nijtmansplain2008-11-14 16:15:08
Created lower-priority follow-up: [ 2282547 ] load of ill-behaved shared library from VFS: core dump
Log in (anonymous is fine) to add a comment.