Skip to content

resetting subscriber leads to crash #349

Closed

Description

@Karsten1987

given the following code: https://gist.github.com/Karsten1987/82837b87fd11ef23353754b9fa31cf7a

the situation:

1.) node spawns a subscriber and a publisher
2.1) main thread spins the executor, having sub and pub talking
2.2) second thread randomly stops the subscription (resetting the shared_ptr of it)
3.) program crashes with the backtrace at the bottom of the gist.

quickly discussed the problem with @wjwwood, when resetting the subscription, the executor still has a raw handle on it which leads to race conditions. The problem can be addressed by turning the handle into a shared pointer.

concretely speaking, this function should return a shared_ptr instead of a raw pointer.

Activity

  1. added
    bug
    on Aug 4, 2017
  2. self-assigned this
    on Aug 4, 2017
  3. dhood commented on Aug 23, 2017

    @dhood
    Member

    this is the permalink to the function @Karsten1987 is referencing in his post (in case those lines move around):

    RCLCPP_PUBLIC
    const rcl_subscription_t *
    get_subscription_handle() const;

  4. deng02 commented on Jan 16, 2018

    @deng02
    Contributor

    We have been hitting this issue when using the ROS2-to-ROS1 ros1_bridge with bridge_all_2to1_topics set to false. When the ROS1 subscriber for a topic disappers the ROS2 subscriber is destroyed and sometimes this happens while the wait set is still holding a raw pointer to a member of that object. The result is various segfault errors within rmw_wait.

  5. added this to the bouncy milestone on Feb 26, 2018
  6. wjwwood commented on Mar 12, 2018

    @wjwwood
    Member

    I believe #431 closes this, please comment here if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions