Skip to content

Fix segfault when the last subscriber leaves before any camera_info - #1263

Open
ahcorde wants to merge 1 commit into
rollingfrom
ahcorde/rolling/fix_rectify_segfault
Open

ahcorde wants to merge 1 commit into
rollingfrom
ahcorde/rolling/fix_rectify_segfault

Conversation

@ahcorde

@ahcorde ahcorde commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

When a lazy node had received images but no camera_info and its last subscriber left, the node crashed. CameraSubscriber::shutdown() destroys the subscriptions but leaves the image/camera_info sync check timer running. When the timer
fires, it calls getTopic() on the destroyed subscription and segfaults.

This PR resets the subscriber instead of calling shutdown(). That destroys the timer too, and the node subscribes again when a new subscriber appears.

Applied to the nodes with the same pattern:

  • image_proc: rectify, resize, crop_decimate, track_marker
  • image_rotate: image_rotate, image_flip
  • depth_image_proc: point_cloud_xyz, point_cloud_xyz_radial

Tested with image_publisher publishing its camera_info on another topic and a subscriber that comes and goes:

  • On rolling, rectify_node and point_cloud_xyz_node crash; with this PR they keep running.
  • rectify_node still subscribes again: the first and second subscribers both get 10 Hz.

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde self-assigned this Dec 3, 2026
@mergify

mergify Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

1 participant