#1479·jna

在 Windows 10+ 上,不正确的线程脱离会导致 LDR 死锁

作者: apavlyutkin创建于 2022年11月15日更新于 2025年12月6日

JNA: any JVM: any OpenJDK based OS: Windows 10+ Recently, I analyzed a hang in a customer application raised against Zulu11.54+26-SA (before the same customer complained about a jdk-8 based JVM assembly). The dump for the issue had the following stacktrace. .306 Id: 27f4.3f70 Suspend: 0 Teb: 00000000`54696000 Unfrozen "foo" Start: .306 Id: 27f4.3f70 Suspend: 0 Teb: 00000000`54696000 Unfrozen "foo" Start: ucrtbase!thread_start<unsigned int (__cdecl*)(void * __ptr64)> (00007ffb`6a092650)ucrtbase!thread_start<unsigned int (__cdecl*)(void * __ptr64)> (00007ffb`6a092650) Priority: 0 Priority class: 32 Affinity: fff # Child-SP RetAddr Call Site Priority: 0 Priority class: 32 Affinity: fff # Child-SP RetAddr Call Site 00 00 00000001`7f60e698 00007ffb`6a458933 ntdll!NtWaitForSingleObject+0x14 00000001`7f60e698 00007ffb`6a458933 ntdll!NtWaitForSingleObject+0x14 01 01 00000001`7f60e6a0 00007ffb`3bc1226f KERNELBASE!WaitForSingleObjectEx+0x93 00000001`7f60e6a0 00007ffb`3bc1226f KERNELBASE!WaitForSingleObjectEx+0x93 02 02 00000001`7f60e740 00007ffb`3bbe61dc jvm!os::PlatformEvent::park+0x8f00000001`7f60e740 00007ffb`3bbe61dc jvm!os::PlatformEvent::park+0x8f [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\os\windows\os_windows.cpp @ 5370] [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\os\windows\os_windows.cpp @ 5370] 03 03 (Inline Function) --------`-------- jvm!ParkCommon+0x8(Inline Function) --------`-------- jvm!ParkCommon+0x8 [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 404] [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 404] 04 04 00000001`7f60e770 00007ffb`3bbe6a81 jvm!Monitor::ILock+0x5c00000001`7f60e770 00007ffb`3bbe6a81 jvm!Monitor::ILock+0x5c [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 465] [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 465] 05 05 (Inline Function) --------`-------- jvm!Monitor::lock_without_safepoint_check+0x8(Inline Function) --------`-------- jvm!Monitor::lock_without_safepoint_check+0x8 [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 938] [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 938] 06 06 00000001`7f60e7a0 00007ffb`3bc7ad23 jvm!Monitor::lock_without_safepoint_check+0x3100000001`7f60e7a0 00007ffb`3bc7ad23 jvm!Monitor::lock_without_safepoint_check+0x31 [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 944] [c:\jenkins\workspace\zulu11-build-win64\zulu-src.git\src\hotspot\share\runtime\mutex.cpp @ 944] 07 07 00000001`7f60e7d0 00007ffb`3bc7d328 jvm!SafepointSynchronize::block+0x17300000001`7f60e7d0 00007ffb`3bc7d328 …

内容来源: java-native-access/jna