Artifacts Associated With Ticket 1011715
Ticket change [531a5a3668] (rid 126423) by nobody on 2004-08-18 19:38:33:
- assignee initialized to: "kennykb"
- cmimetype initialized to: "text/plain"
- comment initialized to:
platform: linux, gcc 2.95.3 The c-library function exit() cannot reach C++-destructors which has been registered via atexit() . This happens, because tcl8.5.xxx unloads any shared library associated with a registered package. example: ----------- t.cpp -------------------------- #include <tcl.h> class X { public: ~X() {}; }; extern "C" int T_Init( Tcl_Interp * interp ) { static X x; return TCL_OK; } --------------------------------------------- make a shared library: g++ -o libt.so -shared -fPIC -I../generic t.cpp Then, in tclsh: "load libt.so; exit" ends up with a core dump. (1) load libt.so load the dll and calls T_Init() (2) g++ registers an exit-handler calling atexit() after constructing the static object x of class X. (3) at end: TclpUnloadFile() calls dlclose() for this package (4) Tcl calls exit() (5) exit() calls the exit-handler registered in step (2), which unfortunately has been unloaded in step (3) The unload behavior is controlled by the macro TCL_UNLOAD_DLLS. The current snapshot's Makefile.in defines this macro as -DTCL_UNLOAD_DLLS=1 Having -DTCL_UNLOAD_DLLS=0 as default would ensure compatibility with previous versions (no implicit unload). -- [email protected] - foundin initialized to: "obsolete: 8.5a2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "40. Dynamic Loading"
- title initialized to: "segfault in exit() due to unloaded shared library"
- type initialized to: "Bug"
Ticket change [06265efb71] (rid 89169) by kennykb on 2004-08-20 02:39:23:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=99768 Donal, this appears to be TIP#100 stuff. It appears that the stanza of code beginning at line 1155 of tclLoad.c is unloading all packages, irrespective of whether they support a Foo_Unload entry point, and therefore unloading packages that aren't designed to be unloaded. Should the test for pkgPtr->fileName[0] perhaps also include a test that pkgPtr->unloadProc is non-NULL, to indicate that the package expects to be unloaded early?
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [0f4118d046] (rid 94754) by dkf on 2004-08-20 03:22:51:
- assignee changed to: "kennykb"
- icomment:
Logged In: YES user_id=79902 TIP#100 is silent on the exact topic. :^(
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [4e6ecf999a] (rid 127233) by kennykb on 2004-09-08 04:55:52:
- assignee changed to: "mistachkin"
- icomment:
Logged In: YES user_id=99768 Joe, do you think it'll take a TIP to fix this? We don't define a Foo_Unload for process exit, and the interpreter is no longer available. Any thoughts?
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [cf09298e7e] (rid 112888) by dkf on 2004-09-08 05:25:12:
- assignee changed to: "kennykb"
- icomment:
Logged In: YES user_id=79902 Deeper consideration: It would be easy to either not unload DLLs at all on Finalize or only unload the DLLs on finalize if they support unloading at other times. But we need input from someone like Joe Mistachkin on this; IIRC he's one of the (potential?) users of unloading, and might want the facility for non-Tcl-aware libs too... I've insufficient experience to help here (I prefer to consider C++ as part of the problem space, a bit like PL/1 was reputed to be.)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [dc45f60069] (rid 108109) by dkf on 2004-09-08 15:19:26:
- assignee changed to: "mistachkin"
Ticket change [eb46f4b05a] (rid 103521) by mistachkin on 2004-10-10 02:38:01:
- icomment:
Logged In: YES user_id=113501 It would seem from reading the description of the problem above that gcc expects the atexit() handlers to be called prior to the DLL being unloaded? Is there any way we can figure out those handlers and call them ourselves? Perhaps we can "hook" atexit(), figure out which DLL invoked it, and simply call the handlers ourselves prior to unloading the DLL in question.
- login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"
- icomment:
Ticket change [d69bf12b3b] (rid 123836) by dkf on 2004-12-23 23:43:36:
- icomment:
Logged In: YES user_id=79902 xref Tcl bug 1082283 maybe?
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [bd8772a1e7] (rid 101921) by dgp on 2005-11-02 00:22:14:
- icomment:
Logged In: YES user_id=80530 Have finalization fixes since the latest comments resolved this?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [da45db7710] (rid 107743) by dgp on 2006-03-10 13:43:47:
- priority changed to: "9 Immediate"
Ticket change [536270611a] (rid 93751) by dgp on 2007-10-25 22:29:56:
- icomment:
Logged In: YES user_id=80530 Originator: NO status?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [cc00688e6f] (rid 95614) by dgp on 2007-12-04 01:47:02:
- icomment:
Logged In: YES user_id=80530 Originator: NO Is there still an 8.5.0-blocking issue here?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [3822e689df] (rid 112153) by dgp on 2007-12-07 02:33:05:
- icomment:
Logged In: YES user_id=80530 Originator: NO I can't block for a bug, no matter how serious, if there's apparently no one working on a solution.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "dgp"
- icomment:
Ticket change [1949ebd3cf] (rid 122785) by georgeps on 2007-12-18 01:33:59:
- icomment:
Logged In: YES user_id=585068 Originator: NO For what it's worth I can't duplicate this in Ubuntu 7.x with gcc 4.1.2 and /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.8 I suspect based on some searching, that this issue was fixed in libstdc++ by using cxa_finalize when a library is unloaded/dlclose() Also, a minor clarification; the code generated by g++ is calling cxa_atexit, and not atexit(). So, I suggest unless there is further input from the submitter, that this bug be closed.
- login: "georgeps"
- mimetype: "text/plain"
- username: "georgeps"
- icomment:
Ticket change [cf918d8069] (rid 113007) by dgp on 2007-12-18 01:59:36:
- closedate changed to: "2007-12-17T18:59:36"
- closer changed to: "dgp"
- resolution changed to: "Out of Date"
- status changed to: "Pending"
Ticket change [5ba7946aac] (rid 118366) by sf-robot on 2008-01-01 10:20:07:
- closedate changed to: "2008-01-01T03:20:07"
- closer changed to: "sf-robot"
- icomment:
Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
- login: "sf-robot"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "sf-robot"