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
Run test_multithreaded__rmw_dps_cpp.multi_access_publisher in a loop until it hangs. I can reproduce this frequently with rmw_dps and less frequently with rmw_fastrtps.
while gtest_multithreaded__rmw_dps_cpp --gtest_filter=test_multithreaded__rmw_dps_cpp.multi_access_publisher; do echo $?; done
Expected behavior
The test does not hang.
Actual behavior
The test hangs.
Additional information
I believe the following is what is happening inside MultiThreadedExecutor::run():
Thread A gets a timer callback. This sets the callback group's can_be_taken_from to false and inserts the timer into scheduled_timers_.
Thread B then tries to get the next callback, but can_be_taken_from is false, so it calls rmw_wait.
Thread A executes the callback. This sets can_be_taken_from to true and wakes up thread B.
Thread B wakes up, gets the next callback but sees that it is the timer in scheduled_timers_ so continues. The lock is released but before the AnyExecutable destructor is run.
Thread C gets the lock and tries to get the next executable. The group's can_be_taken_from is false so it calls rmw_wait.
Thread B runs calling the AnyExecutable destructor, setting can_be_taken_from to true but not triggering the guard condition.
Thread A tries to get the wait_mutex_ to clear the scheduled_timer_, but B has the lock and is waiting to be triggered.
Activity
Fix hang with timers in MultiThreadedExecutor (ros2#835)
Fix hang with timers in MultiThreadedExecutor (#835) (#836)
ivanpauno commentedon Aug 30, 2019
Fixed in #836, closing!
Fix hang with timers in MultiThreadedExecutor (#835) (#836)
Fix hang with timers in MultiThreadedExecutor (#835) (#836) (#869)
basic ipc implementation from alsora/new_ipc_proposal
basic ipc implementation from alsora/new_ipc_proposal
New Intra-Process Communication (#778)
Import Debian changes 16.0.1-1jammy
Add convenient node method to get a final topic/service name (ros2#835)
Fix hang with timers in MultiThreadedExecutor (ros2#835) (ros2#836)
New Intra-Process Communication (ros2#778)