diwic / dbus-rs

D-Bus binding for the Rust language
Other
589 stars 133 forks source link

Possible deadlock in dbus-tokio #425

Closed harryoooooooooo closed 1 year ago

harryoooooooooo commented 1 year ago

Hi diwic@, I'm Hsin-chen from Google.

We noticed a deadlock in our program. According to the stack trace (attached below), the scenario is like:

  1. Stack # 17, the IOResource is polled by the tokio runtime and tries to handle the incoming method
    • At this point the wake lock is already held here
  2. Stack # 13, in our main function we call Crossroads::handle_message on a new method is received
  3. Stack # 11, our method handler returns and crossroads attempt to flush the message
  4. Stack # 8, dbus found that the message is buffered so it tries to wake the resource up
    • The waker is defined here

It's clear that in step 1 and step 4 the thread tries to lock the same mutex twice. I've inserted some logs and verified it.

For what it's worth, we also noticed that the deadlock usually happens when there is a really near (<5 us) outgoing method call.

Though we're not using the latest released version, it seems the call path is still valid on HEAD. Could you help take a look? Please let me know if you need more logs or help reproducing the issue. Thanks.

Thread 2 (Thread 0x7fc780c87640 (LWP 862) "tokio-runtime-w"):
#0  0x00007fc780ff4219 in syscall () from target:/lib64/libc.so.6
#1  0x00005ad5ace219a5 in std::sys::unix::futex::futex_wait ()
#2  0x00005ad5ace26288 in <std::sys::unix::locks::futex_mutex::Mutex>::lock_contended ()
#3  0x00005ad5acd7059f in std::sys::unix::locks::futex_mutex::Mutex::lock (self=0x5ad5ad6aa0b0) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/sys/unix/locks/futex_mutex.rs:30
#4  std::sys_common::mutex::MovableMutex::raw_lock () at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/sys_common/mutex.rs:75
#5  std::sync::mutex::Mutex<dbus_tokio::connection::WakeStatus>::lock<dbus_tokio::connection::WakeStatus> (self=0x5ad5ad6aa0b0) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/sync/mutex.rs:267
#6  dbus_tokio::connection::from_channel::{closure#0}<dbus::nonblock::SyncConnection> () at [floss]/../external/rust/vendor/dbus-tokio-0.7.5/src/connection.rs:260
#7  0x00005ad5acd323e5 in alloc::boxed::{impl#46}::call<(), (dyn core::ops::function::Fn<(), Output=core::result::Result<(), ()>> + core::marker::Send + core::marker::Sync), alloc::alloc::Global> (self=<optimized out>, args=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/alloc/src/boxed.rs:1954
#8  dbus::nonblock::{impl#27}::send::{closure#0} (wake=<optimized out>) at [floss]/../external/rust/vendor/dbus-0.9.5/src/nonblock.rs:134
#9  core::option::Option<&alloc::boxed::Box<(dyn core::ops::function::Fn<(), Output=core::result::Result<(), ()>> + core::marker::Send + core::marker::Sync), alloc::alloc::Global>>::map<&alloc::boxed::Box<(dyn core::ops::function::Fn<(), Output=core::result::Result<(), ()>> + core::marker::Send + core::marker::Sync), alloc::alloc::Global>, bool, dbus::nonblock::{impl#27}::send::{closure_env#0}> (self=..., f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/option.rs:929
#10 dbus::nonblock::{impl#27}::send (self=0x5ad5ad6ac520, msg=...) at [floss]/../external/rust/vendor/dbus-0.9.5/src/nonblock.rs:134
#11 0x00005ad5accc822c in dbus_crossroads::context::Context::flush_messages<dbus::nonblock::SyncConnection> (self=0x7fc780c861c0, conn=0x5ad5ad6ac520) at ../external/rust/vendor/dbus-crossroads-0.4.0/src/context.rs:102
#12 0x00005ad5accce63c in dbus_crossroads::crossroads::Crossroads::handle_message<dbus::nonblock::SyncConnection> (self=0x5ad5ad6af7b8, message=..., conn=0x5ad5ad6ac520) at ../external/rust/vendor/dbus-crossroads-0.4.0/src/crossroads.rs:228
#13 0x00005ad5accd92c0 in btmanagerd::main::{async_block#0}::{closure#3} (msg=..., conn=0x5ad5ad6ac520) at system/gd/rust/linux/mgmt/src/bin/btmanagerd/main.rs:147
#14 0x00005ad5acd32950 in alloc::boxed::{impl#45}::call_mut<(dbus::message::Message, &dbus::nonblock::SyncConnection), (dyn core::ops::function::FnMut<(dbus::message::Message, &dbus::nonblock::SyncConnection), Output=bool> + core::marker::Send), alloc::alloc::Global> (self=0x7fc780c864c0, args=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/alloc/src/boxed.rs:1947
#15 dbus::nonblock::{impl#30}::process_one (self=0x5ad5ad6ac520, msg=...) at [floss]/../external/rust/vendor/dbus-0.9.5/src/nonblock.rs:216
#16 0x00005ad5accc7dc8 in dbus::nonblock::Process::process_all<dbus::nonblock::SyncConnection> (self=0x5ad5ad6ac520) at ../external/rust/vendor/dbus-0.9.5/src/nonblock.rs:376
#17 0x00005ad5accda97e in dbus_tokio::connection::IOResource<dbus::nonblock::SyncConnection>::poll_internal<dbus::nonblock::SyncConnection> (self=0x5ad5ad6acc18, ctx=0x7fc780c86870) at ../external/rust/vendor/dbus-tokio-0.7.5/src/connection.rs:152
#18 dbus_tokio::connection::{impl#5}::poll<dbus::nonblock::SyncConnection> (self=..., ctx=0x7fc780c86870) at ../external/rust/vendor/dbus-tokio-0.7.5/src/connection.rs:205
#19 0x00005ad5accd2529 in btmanagerd::main::{async_block#0}::{async_block#1} () at system/gd/rust/linux/mgmt/src/bin/btmanagerd/main.rs:84
#20 core::future::from_generator::{impl#1}::poll<btmanagerd::main::{async_block#0}::{async_block_env#1}> (self=..., cx=0x2) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/future/mod.rs:91
#21 0x00005ad5acccc44d in tokio::runtime::task::core::{impl#3}::poll::{closure#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>> (ptr=0x5ad5ad6aa0b0) at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/core.rs:165
#22 tokio::loom::std::unsafe_cell::UnsafeCell<tokio::runtime::task::core::Stage<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>>::with_mut<tokio::runtime::task::core::Stage<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>, core::task::poll::Poll<()>, tokio::runtime::task::core::{impl#3}::poll::{closure_env#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>> (self=0x5ad5ad6aa0b0, f=...) at ../external/rust/vendor/tokio-1.19.2/src/loom/std/unsafe_cell.rs:14
#23 tokio::runtime::task::core::CoreStage<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>::poll<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>> (self=0x5ad5ad6aa0b0, cx=...) at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/core.rs:155
#24 0x00005ad5accbdc6e in tokio::runtime::task::harness::poll_future::{closure#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>> () at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:470
#25 core::panic::unwind_safe::{impl#23}::call_once<core::task::poll::Poll<()>, tokio::runtime::task::harness::poll_future::{closure_env#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>> (self=..., _args=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/panic/unwind_safe.rs:271
#26 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>>, core::task::poll::Poll<()>> (data=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:492
#27 std::panicking::try<core::task::poll::Poll<()>, core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>>> (f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:456
#28 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>>>, core::task::poll::Poll<()>> (f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panic.rs:137
#29 tokio::runtime::task::harness::poll_future<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>> (core=0x5ad5ad6aa0b0, id=..., cx=...) at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:458
#30 0x00005ad5accc1932 in tokio::runtime::task::harness::Harness<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>, alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>>::poll_inner<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>, alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>> (self=<optimized out>) at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:104
#31 tokio::runtime::task::harness::Harness<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>, alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>>::poll<core::future::from_generator::GenFuture<btmanagerd::main::{async_block#0}::{async_block_env#1}>, alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>> (self=...) at ../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:57
#32 0x00005ad5ace63287 in tokio::runtime::task::raw::RawTask::poll (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/raw.rs:84
#33 tokio::runtime::task::LocalNotified<alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>>::run<alloc::sync::Arc<tokio::runtime::thread_pool::worker::Shared>> (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/mod.rs:376
#34 tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure#0} () at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:435
#35 tokio::coop::with_budget::{closure#0}<core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>, tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure_env#0}> (cell=0x7fc780c875cd) at [floss]/../external/rust/vendor/tokio-1.19.2/src/coop.rs:102
#36 std::thread::local::LocalKey<core::cell::Cell<tokio::coop::Budget>>::try_with<core::cell::Cell<tokio::coop::Budget>, tokio::coop::with_budget::{closure_env#0}<core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>, tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure_env#0}>, core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>> (self=<optimized out>, f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/thread/local.rs:445
#37 std::thread::local::LocalKey<core::cell::Cell<tokio::coop::Budget>>::with<core::cell::Cell<tokio::coop::Budget>, tokio::coop::with_budget::{closure_env#0}<core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>, tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure_env#0}>, core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>> (self=<optimized out>, f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/thread/local.rs:421
#38 0x00005ad5ace5f912 in tokio::coop::with_budget<core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>, tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure_env#0}> (budget=..., f=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/coop.rs:95
#39 tokio::coop::budget<core::result::Result<alloc::boxed::Box<tokio::runtime::thread_pool::worker::Core, alloc::alloc::Global>, ()>, tokio::runtime::thread_pool::worker::{impl#1}::run_task::{closure_env#0}> (f=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/coop.rs:72
#40 tokio::runtime::thread_pool::worker::Context::run_task (self=0x7fc780c86af0, task=..., core=0x5ad5ad6a1c10) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:434
#41 0x00005ad5ace5f6f7 in tokio::runtime::thread_pool::worker::Context::run (self=0x7fc780c86af0, core=0x5ad5ad6a1c10) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:408
#42 0x00005ad5ace65756 in tokio::runtime::thread_pool::worker::run::{closure#0} () at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:386
#43 tokio::macros::scoped_tls::ScopedKey<tokio::runtime::thread_pool::worker::Context>::set<tokio::runtime::thread_pool::worker::Context, tokio::runtime::thread_pool::worker::run::{closure_env#0}, ()> (self=<optimized out>, t=0x7fc780c86af0, f=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/macros/scoped_tls.rs:61
#44 0x00005ad5ace5f1c5 in tokio::runtime::thread_pool::worker::run (worker=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:383
#45 0x00005ad5ace68183 in tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure#0} () at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/thread_pool/worker.rs:362
#46 tokio::runtime::blocking::task::{impl#2}::poll<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}, ()> (self=..., _cx=<optimized out>) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/blocking/task.rs:42
#47 0x00005ad5ace5de3a in tokio::runtime::task::core::{impl#3}::poll::{closure#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>> (ptr=0x5ad5ad6a2ca0) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/core.rs:165
#48 tokio::loom::std::unsafe_cell::UnsafeCell<tokio::runtime::task::core::Stage<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>>::with_mut<tokio::runtime::task::core::Stage<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>, core::task::poll::Poll<()>, tokio::runtime::task::core::{impl#3}::poll::{closure_env#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>> (self=0x5ad5ad6a2ca0, f=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/loom/std/unsafe_cell.rs:14
#49 tokio::runtime::task::core::CoreStage<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>::poll<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>> (self=0x5ad5ad6a2ca0, cx=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/core.rs:155
#50 0x00005ad5ace6704c in tokio::runtime::task::harness::poll_future::{closure#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>> () at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:470
#51 core::panic::unwind_safe::{impl#23}::call_once<core::task::poll::Poll<()>, tokio::runtime::task::harness::poll_future::{closure_env#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>> (self=..., _args=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/panic/unwind_safe.rs:271
#52 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>>, core::task::poll::Poll<()>> (data=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:492
#53 std::panicking::try<core::task::poll::Poll<()>, core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>>> (f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:456
#54 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tokio::runtime::task::harness::poll_future::{closure_env#0}<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>>>, core::task::poll::Poll<()>> (f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panic.rs:137
#55 tokio::runtime::task::harness::poll_future<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>> (core=0x5ad5ad6a2ca0, id=..., cx=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:458
#56 tokio::runtime::task::harness::Harness<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>, tokio::runtime::blocking::schedule::NoopSchedule>::poll_inner<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>, tokio::runtime::blocking::schedule::NoopSchedule> (self=<optimized out>) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:104
#57 0x00005ad5ace66fb3 in tokio::runtime::task::harness::Harness<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>, tokio::runtime::blocking::schedule::NoopSchedule>::poll<tokio::runtime::blocking::task::BlockingTask<tokio::runtime::thread_pool::worker::{impl#0}::launch::{closure_env#0}>, tokio::runtime::blocking::schedule::NoopSchedule> (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/harness.rs:57
#58 0x00005ad5ace5c9e9 in tokio::runtime::task::raw::RawTask::poll (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/raw.rs:84
#59 tokio::runtime::task::UnownedTask<tokio::runtime::blocking::schedule::NoopSchedule>::run<tokio::runtime::blocking::schedule::NoopSchedule> (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/task/mod.rs:413
#60 tokio::runtime::blocking::pool::Task::run (self=...) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/blocking/pool.rs:91
#61 tokio::runtime::blocking::pool::Inner::run (self=0x5ad5ad6a15f0, worker_thread_id=<optimized out>) at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/blocking/pool.rs:325
#62 0x00005ad5ace5fd7f in tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure#0} () at [floss]/../external/rust/vendor/tokio-1.19.2/src/runtime/blocking/pool.rs:300
#63 std::sys_common::backtrace::__rust_begin_short_backtrace<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()> (f=...) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/sys_common/backtrace.rs:122
#64 0x00005ad5ace58d0e in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()> () at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/thread/mod.rs:514
#65 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()>> (self=<error reading variable: Cannot access memory at address 0x0>, _args=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/panic/unwind_safe.rs:271
#66 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()>>, ()> (data=<optimized out>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:492
#67 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()>>> (f=<error reading variable: Cannot access memory at address 0x0>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panicking.rs:456
#68 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()>>, ()> (f=<error reading variable: Cannot access memory at address 0x0>) at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/panic.rs:137
#69 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()> () at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/std/src/thread/mod.rs:513
#70 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<tokio::runtime::blocking::pool::{impl#4}::spawn_thread::{closure_env#0}, ()>, ()> () at /var/cache/portage/dev-lang/rust-artifacts/src/rustc-1.65.0-src/library/core/src/ops/function.rs:248
#71 0x00005ad5ace2b803 in <std::sys::unix::thread::Thread>::new::thread_start ()
#72 0x00007fc780f77bec in start_thread () from target:/lib64/libc.so.6
#73 0x00007fc780ffb400 in clone () from target:/lib64/libc.so.6
diwic commented 1 year ago

Hi and thanks for reporting the bug with a good stack trace!

I've tried to fix it in the commit referenced above this commit, could you have a look and see that it resolves the issue (and does not cause other issues)? Thanks!

harryoooooooooo commented 1 year ago

Hi diwic@, I've stress tested the patch in the past day and it worked fine. Great thanks for your quick fix!

harryoooooooooo commented 1 year ago

Hi @diwic, could you tell when will be the next dbus-tokio release? That would be great if the fix above is included in any release tag. Thanks!

diwic commented 1 year ago

@harryoooooooooo 0.7.6 released now, enjoy! :-)