Bug #53012 [Ver->Sus]: On shared module unload: Unloading DLL containing an active critical section.

From: Date: Wed, 21 Jul 2021 16:25:55 +0000
Subject: Bug #53012 [Ver->Sus]: On shared module unload: Unloading DLL containing an active critical section.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235246@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53012&edit=1 ID: 53012 Updated by: cmb@php.net Reported by: cataphract@php.net Summary: On shared module unload: Unloading DLL containing an active critical section. -Status: Verified +Status: Suspended Type: Bug Package: Scripting Engine problem Operating System: Vista amd64 PHP Version: trunk-SVN-2010-10-07 (SVN) -Assigned To: cmb +Assigned To: Block user comment: N Private report: N New Comment: > […]; would need to build that to check. But failed to. They switched to meson some while ago, and apparently that doesn't work well with our glib dependencies. Since we have to wait for a new libsodium release anyway, I suspend this ticket for the time being. Previous Comments: ------------------------------------------------------------------------ [2021-06-02 14:42:42] cmb@php.net To fix the TLS issue as well, we'd need to apply something like the following on top of glib 2.53.3: glib/gthread-win32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 938ed5f..2b9381b 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -1096,6 +1096,7 @@ g_thread_win32_thread_detach (void) void g_thread_win32_process_detach (void) { + GPrivateDestructor *dtor; #ifndef _MSC_VER if (SetThreadName_VEH_handle != NULL) { @@ -1103,6 +1104,11 @@ g_thread_win32_process_detach (void) SetThreadName_VEH_handle = NULL; } #endif + DeleteCriticalSection (&g_private_lock); + for (dtor = g_private_destructors; dtor; dtor = dtor->next) + { + TlsFree (dtor->index); + } } /* vim:set foldmethod=marker: */ I'm not sure though, whether this is still relevant for latest glib (2.68.2); would need to build that to check. ------------------------------------------------------------------------ [2021-05-25 15:26:33] cmb@php.net The enchant issue is actually a glib issue. After applying glib/gthread-win32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 938ed5f..9c3dc6a 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -1103,6 +1103,7 @@ g_thread_win32_process_detach (void) SetThreadName_VEH_handle = NULL; } #endif + DeleteCriticalSection (&g_private_lock); } /* vim:set foldmethod=marker: */ the critical section issue is gone, but instead VERIFIER STOP 0000000000000350: pid 0x421C: Unloading DLL that allocated TLS index that was not freed. 000000000016ABBA : TLS index 000001D55627BE4C : Address of the code that allocated this TLS index. 000001D555504FE0 : DLL name address. Use du to dump it. 000001D5561E0000 : DLL base address. is reported for glib-2.dll. I'll dig deeper. ------------------------------------------------------------------------ [2021-05-25 13:48:14] cmb@php.net <https://github.com/jedisct1/libsodium/pull/1058> has been merged, so there's now only the enchant issue. ------------------------------------------------------------------------ [2021-05-11 15:16:13] cmb@php.net I just submitted a PR against libsodium: <https://github.com/jedisct1/libsodium/pull/1055> ------------------------------------------------------------------------ [2021-02-26 17:21:19] cmb@php.net I cannot reproduce this wrt. intl (may have been fixed in the meantime), but for sodium and enchant. I checked sodium more closely, and found that the message is triggered due to a missing DeleteCriticalSection() call in libsodium. So this would be an upstream issue. However, not calling DeleteCriticalSection() is not really an issue per se, so it may be hard to convince upstream maintainers to cater to that. Enchant doesn't directly deal with CRITICAL_SECTIONs, so this would be a glib issue. I haven't investigated closer on that, though. Anyhow, not having this fixed would make it hard to actually run the PHP test suite or doing development/debugging with AppVerifier enabled, if these extensions are loaded, although it might make sense to do so. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53012 -- Edit this bug report at https://bugs.php.net/bug.php?id=53012&edit=1

« previous php.bugs (#235246) next »