Skip to content

the subscriber's destructor does not wait until currently processing callbacks are exited #2447

@GoesM

Description

@GoesM

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • the latest
  • DDS implementation:
    • defaulted
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

the subscriber's destructor does not wait until currently processing callbacks are exited, which may cause troubles like UAF, null-pointer bugs.

Details are shown in navigation2 stack: ros-navigation/navigation2#4166

Expected behavior

We believe that the destructor of subscriber should have mechanisms to ensure complete release of relevant resources and fully exit ongoing works.

Actual behavior

there's no such mechanism.

Additional information

If there is no wait mechanism implemented in the subscriber's destructor to ensure that currently processing callbacks are exited beforehand, it could introduce the possibility of the freed pointer being accessed by ongoing tasks within the subscriber.

Consequently, this scenario may lead to instances of Use-After-Free (UAF) and null-pointer bugs. One illustrative example can be found within the navigation2 stack, as documented in the following issue: ros-navigation/navigation2#4166

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions