Skip to content

Conversation

mxgrey
Copy link
Collaborator

@mxgrey mxgrey commented Aug 23, 2025

As reported by #518 the current main branch experiences a segfault when the user specifies a timeout.

The timeout was caused by a subtle bug where we were exiting from WaitSet::wait early when an error code gets returned from rcl_wait. The original rationale was that if an error happens then it is not valid to continue processing the wait set, and the user will not want to keep spinning it. However, that overlooked two things:

  • A timeout is categorized as an error, but does not imply that there is anything wrong with the wait set
  • There are important cleanup steps that we apply after rcl_wait which get skipped if we exit WaitSet::wait early

This PR tweaks the ordering so that we always do the appropriate cleanup each time WaitSet::wait is called, even if an error is encountered. This also adds a test which currently experiences a segmentation fault on main.

mxgrey added 4 commits August 23, 2025 00:21
Signed-off-by: Michael X. Grey <[email protected]>
Signed-off-by: Michael X. Grey <[email protected]>
Signed-off-by: Michael X. Grey <[email protected]>
Signed-off-by: Michael X. Grey <[email protected]>
Copy link
Collaborator

@esteve esteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxgrey thanks! LGTM

@esteve esteve merged commit 7d4ed60 into ros2-rust:main Aug 23, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants