From: Neophytos D. <neo...@gm...> - 2024-07-29 11:22:58
|
Hi Sergey, Thanks for your message. Answers below. did you test it before or after [96910cd8822ffb8f] > <https://core.tcl-lang.org/tcl/info/96910cd8822ffb8f>? Just to ensure it > is still acute... > It was with tcl 9.0b2, so before that change. > The whole "unload" thing was initially introduced by Nathan in > [3b0e92b198b86975] <https://core.tcl-lang.org/tcl/info/3b0e92b198b86975>, > however it seemed to have some issues (like [34870ab5756911d1] > <https://core.tcl-lang.org/tcl/info/34870ab5756911d1> or > [ae09f6b190ceec31] <https://core.tcl-lang.org/tcl/info/ae09f6b190ceec31>), > which I tried to fix in the last time as good as I was able to do that. > I cannot tell if it is relevant or not. It does not look like it. > Which versions (and platforms) are affected or do you mean exactly here? > Is it stock tcl or some application of you, that uses Tcl as a subsystem > (in particular, it is Tcl_Main* or your own main)? > It was a tcl file that loaded twebserver in the main thread and twebserver, tjson and thtml in the spawn twebserver threads. All of these extensions were using Tcl_CreateThreadExitHandler in their initialization function. They did not have to but I did not notice that was the case before this issue. Changing them all to use CreateExitHandler seems to have resolved the issue. I will investigate further tomorrow and report back but my guess is that there is a TCL_TSD_INIT used somewhere when the thread exit handler runs that causes this issue during unload. Regards, Neophytos PS. My apologies but I have to run right now. I will check further tomorrow and report back. Regards, > Sergey. > > 29.07.2024 10:29, Neophytos Demetriou wrote: > > Hi, > > When the PURIFY flag is used Tcl_Exit calls Tcl_Finalize that in turn > calls TclFinalizeSynchronization, which sets tsdGlobal.key to NULL via > TclFinalizeThreadStorage. > > Then, when it afterwards tries to unload extensions, it attempts to use > the TSD (thread-specific data) again and because tsdGlobal.key is NULL, the > AddressSanitizer complains about a NULL pthread key. > > I was not able to track where the TSD is used during unloading or if this > is an issue with the extensions being used and whether they have to unload > in a specific way. As a consequence I stopped using the PURIFY flag but if > anyone has any suggestions, please let us know. > > Kind regards, > Neophytos > > _______________________________________________ > Tcl-Core mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/tcl-core > > |