bytehound
bytehound copied to clipboard
Deadlock when linking libGLdispatch
I'm seeing the following deadlock at program start:
Thread 2 (Thread 0x7f9fafbff640 (LWP 520330) "mem-prof"):
#0 0x00007f9fb0c41600 in __lll_lock_wait () from /usr/lib/libpthread.so.0
#1 0x00007f9fb0c3a580 in pthread_mutex_lock () from /usr/lib/libpthread.so.0
#2 0x00007f9fb095eca4 in __cxa_thread_atexit_impl () from /usr/lib/libc.so.6
#3 0x00007f9fb0e1dce5 in std::thread::local::fast::Key::register_dtor<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/thread/local.rs:577
#4 std::sys_common::thread_info::THREAD_INFO::__getit () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/thread/local.rs:220
#5 std::thread::local::LocalKey::try_with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>, std::sys_common::thread_info::set::{closure#0}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/thread/local.rs:398
#6 std::thread::local::LocalKey::with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>, std::sys_common::thread_info::set::{closure#0}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/thread/local.rs:375
#7 std::sys_common::thread_info::set () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/sys_common/thread_info.rs:42
#8 std::thread::{impl#0}::spawn_unchecked::{closure#1}<bytehound::global::spawn_processing_thread::{closure#0}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/thread/mod.rs:482
#9 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#1}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227
#10 0x00007f9fb0e9acd5 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#11 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#12 std::sys::unix::thread::{impl#2}::new::thread_start () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/sys/unix/thread.rs:106
#13 0x00007f9fb0c38259 in start_thread () from /usr/lib/libpthread.so.0
#14 0x00007f9fb0a1d5e3 in clone () from /usr/lib/libc.so.6
Thread 1 (Thread 0x7f9fb05f6300 (LWP 520329) "i4"):
#0 0x00007f9fb0a0453b in sched_yield () from /usr/lib/libc.so.6
#1 0x00007f9fb0df19b2 in std::sys::unix::thread::Thread::yield_now () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/sys/unix/thread.rs:113
#2 std::thread::yield_now () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b//library/std/src/thread/mod.rs:696
#3 bytehound::global::spawn_processing_thread () at preload/src/global.rs:228
#4 bytehound::global::try_enable (state=<optimized out>) at preload/src/global.rs:445
#5 0x00007f9fb0e18ee2 in bytehound::global::StrongThreadHandle::acquire () at preload/src/global.rs:536
#6 bytehound::api::allocate (requested_size=32, kind=...) at preload/src/api.rs:185
#7 bytehound::api::calloc (count=<optimized out>, element_size=140735463581872) at preload/src/api.rs:254
#8 0x00007f9fb0c6dc48 in ?? () from /usr/lib/libdl.so.2
#9 0x00007f9fb0c6d544 in dlsym () from /usr/lib/libdl.so.2
#10 0x00007f9fb064906d in ?? () from /usr/lib/libGLdispatch.so.0
#11 0x00007f9fb1164e2e in call_init () from /lib64/ld-linux-x86-64.so.2
#12 0x00007f9fb1164f1c in _dl_init () from /lib64/ld-linux-x86-64.so.2
#13 0x00007f9fb11560ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#14 0x0000000000000001 in ?? ()
#15 0x00007fff87509551 in ?? ()
#16 0x0000000000000000 in ?? ()
Notably __cxa_thread_atexit_impl tries to acquire the lock held by dlsym (or one of the functions calling dlsym).