Guard DVL bridge spin during ROS shutdown - #52
Open
yeseorizi wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent
DVLBridge::PostUpdate()from callingrclcpp::spin_some()after the ROS context has been invalidated during shutdown.Problem
When Gazebo receives
SIGINT, the ROS context can be shut down while the simulation update thread is still enteringPostUpdate(). The current implementation unconditionally callsrclcpp::spin_some()whenever the simulation is not paused.In the reproduced failure,
spin_some()attempted to construct a temporary executor after the context had become invalid. The resultingrclcpp::exceptions::RCLErrorwas uncaught and aborted the Gazebo server:Change
rclcpp::ok()check and executor construction inspin_some().RCLErrorwhen the context is still valid, so unrelated runtime errors are not hidden.This does not change DVL message conversion or the public interface.
Reproduction
Launch a world containing
DVLBridge, confirm DVL messages, and stop the server withSIGINT. Repeat the launch and shutdown several times:ros2 launch dave_demos dave_sensor.launch.py \ namespace:=dvl world_name:=new_dvl paused:=false \ gui:=true headless:=false # Confirm /dvl/velocity, then press Ctrl-C. Repeat.The stock bridge reproduced one shutdown abort in three trials. The failing process exited with code 134 from
DVLBridge::PostUpdate().Validation
The exact candidate source in this PR was built and tested in an ARM64 Docker environment with ROS 2 Lyrical and Gazebo Jetty.
Repository checks:
Checklist