LobstersWednesday · May 20, 2026FREE

The Windows DLL loader lock: how a Rust thread can hang your JVM

rustjniwindowsdeadlockquestdb

QuestDB's blog post explains a deadlock scenario on Windows where a Rust thread using JNI can hang the JVM. The problem occurs when a Rust thread panics while holding the DLL loader lock, which Windows uses to serialize DLL initialization. If the panic handler attempts to load another DLL (e.g., for logging), it deadlocks because the loader lock is already held. This is specific to Windows due to its loader lock behavior; Linux and macOS do not have this issue. The post recommends avoiding panics in JNI code, using catch_unwind, or ensuring no DLL loads during panic handling. QuestDB encountered this while developing their database engine, which uses Rust for performance-critical JNI components. The fix involves careful Rust thread design to prevent panics in JNI contexts.

// why it matters

Windows JVM users with Rust JNI code risk deadlocks from DLL loader lock conflicts.

Sources

Primary · Lobsters
▸ Read original at questdb.com

Like this? Get the next digest.

The Windows DLL loader lock: how a Rust thread can hang your JVM — aigest.dev