You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_handle_mut::<PgConnectionHandle> hands out a &'static mut from a blocking-pool thread while the main thread can take_handle it #10338
get_handle_mut::<PgConnectionHandle> hands out a &'static mut reference from a tokio blocking-pool thread, while the main thread can simultaneously call take_handle on the very same handle — js_pg_client_end does exactly that.
Why it matters
This is an aliasing hazard: two threads can hold a live mutable reference (one via get_handle_mut, one via take_handle on the main thread) to the same underlying connection handle at the same time, which is undefined behavior in Rust regardless of whether a concrete crash has been observed. This is a pre-existing issue in the legacy spawn_blocking-based path, independent of the turnloop migration.
What would fix it
Whatever synchronization already protects other handle-table accesses (a lock, or restructuring so a handle in active use on a blocking-pool thread cannot be concurrently taken from the main thread) needs to cover PgConnectionHandle too. At minimum, take_handle should not be able to race a live get_handle_mut borrow on the same handle.
Closing as obsolete: the native pg binding was removed in 6e0f111 (#10677, 2026-09-21); pg now compiles from source. This issue describes the removed native implementation, so it no longer applies. If the same behavior reproduces with the real npm package compiled from source on current main, please open a new issue against that path.
Activity
TheHypnoo commentedon Sep 28, 2026
Closing as obsolete: the native pg binding was removed in 6e0f111 (#10677, 2026-09-21); pg now compiles from source. This issue describes the removed native implementation, so it no longer applies. If the same behavior reproduces with the real npm package compiled from source on current main, please open a new issue against that path.