Artifacts Associated With Ticket 545579ffffffffff
Ticket change [f74c462b80] (rid 91351) by jcw on 2002-04-18 10:15:38:
- assignee initialized to: "vincentdarley"
- cmimetype initialized to: "text/plain"
- comment initialized to:
In tclIOUtil.c, there is extensive logic to load shared libs from VFS - even creating a temp copy (see Tcl_FSLoadFile). Loading appears to work fine - the TclVFS extension does not override load, and things are ok with TclKit and Scripted Documents. But unloading does not clean up such a temp file. After long term use, lots of "tclXXXXX" files can accumulate in /tmp (on Linux). This can only be tested from a VFS-mounted FS, because normal loading surely loads as is, no copy made at all. An example is to run tclkit with one of the scripted docs that contain a binary loaded extension - such as in http://www.equi4.com/pub/dok/. Desired behavior: temp copy is deleted after use. In fact, on Unix systems, one can probably delete right after loading - the temp copy does not need to exist when the shared library is in use. This has as major benefit that aborts/crashes do not leave dangling files. On Windows, the file cannot be deleted while in use. The least would be to delete on exit (as the unload logic in tclIOUtil.c appears to be intended). If cleanup even with aborts are desired, then the Windows version may need to do special calls to register the files for cleanup on restart of Windows (not sure what the API is, or where, but it exists). Windows may be harder - also because I'm not sure a DLL should be unloaded by Tcl (the usual reasons come to mind: C++ cleanup handling may not have occurred, and an atexit call into the lib may be pending). If all else fails, then perhaps the only way out is to reuse a fixed set of file names for creating the temp copies ouf of VFS (tcl001.dll. tcl002.dll, etc) - so that at least names are re-used (and long term use do not lead to an unbounded number of copies). Or Tcl could clean up its set of names on startup - multiple invocations are no problem, if the dll is still is use then the delete fails and can be ignored. I'll be happy to help test the different scenario's, but I don't oversee all issues and the core code well enough to be able to code the solutions. Besides, maybe it's almost there, just a few tweaks away from working just fine on Unix and Windows.
- foundin initialized to: "obsolete: 8.4a5"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "jcw"
- subsystem initialized to: "37. File System"
- title initialized to: "cleanup after load from VFS"
- type initialized to: "Bug"
Ticket change [51f459e9c4] (rid 126220) by stevel on 2002-04-19 07:51:44:
- icomment:
Logged In: YES user_id=2460 On MacOS X, a tmp directory is created (in the current directory) and not removed
- login: "stevel"
- mimetype: "text/plain"
- username: "stevel"
- icomment:
Ticket change [daf1c062d9] (rid 107876) by nobody on 2002-04-22 04:54:50:
- icomment:
Logged In: NO There is logic in tclIOUtil.c to unload the file on exit (FSUnloadTempFile), so obviously something is happening to prevent that. Perhaps you can have a look at what goes wrong? If it appears to be an encoding problem, try moving 'TclFinalizeEncodingSubsystem()' to after 'TclFinalizeLoad()' in tclEvent.c (around line 816- 836). No idea about stevel's 'tmp' directory either.
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [fe55a748a6] (rid 108565) by vincentdarley on 2002-05-21 19:58:39:
- icomment:
Logged In: YES user_id=32170 If you can delete the file immediately on Unix, you could try adding before this block of code: /* * When we unload this file, we need to divert the * unloading so we can unload and cleanup the * temporary file correctly. */ tvdlPtr = (FsDivertLoad*) ckalloc(sizeof (FsDivertLoad)); in tclIOUtil.c (around line 2516), the following: /* Try to delete the file immediately */ if (Tcl_FSDeleteFile(copyToPtr) == TCL_OK) { Tcl_DecrRefCount(copyToPtr); (*clientDataPtr) = NULL; (*unloadProcPtr) = NULL; return retVal; } for the problems on Windows, I suggest you put a breakpoint in FSUnloadTempFile and describe what goes wrong --- why the file isn't deleted. - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [7fdee1accd] (rid 97635) by vincentdarley on 2002-05-21 23:53:03:
- icomment:
Logged In: YES user_id=32170 note: for stevel's comment, this 'tmp' thing seems to be created by tcltest -- see bug 558742
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [ede7240751] (rid 103984) by jcw on 2002-05-22 03:20:04:
- icomment:
Logged In: YES user_id=1983 Vince, thanks - your change works (I used the whole file you sent me). As for the tmp/ dir, this used to be in the vfs.tcl (package vfslib), now no longer in tclvfs. That issue should be gone in recent tclkits.
- login: "jcw"
- mimetype: "text/plain"
- username: "jcw"
- icomment:
Ticket change [02886e99e5] (rid 119666) by vincentdarley on 2002-05-30 18:03:53:
- closedate changed to: "2002-05-30T11:03:53"
- closer changed to: "vincentdarley"
- resolution changed to: "Fixed"
- status changed to: "Closed"