Skip to content

Crash in callback group pointer vector iterator #813

Closed

Description

@guillaumeautran

Bug report

Required Info:

  • Operating System:
    • Ubuntu 16.04
  • Installation type:
    • From Source (Crystal P4) But Master branch has the same issue (from code inspection)
  • Version or commit hash:
    • HEAD of Master for RCLCPP
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

There is 2 separate issues here:

  1. A sever crash can occur in the RCLCPP code when a thread is iterating over a callback_group while another thread is creating a new subscription (or timer, service, etc). The iterator over the actual callback group pointer vector is done unprotected by a lock causing a potential concurrent access leading to a crash.
  2. A memory leak is also present in the callback group pointer vector storing weak reference to subscriptions. If the subscription gets destroyed, the weak reference becomes invalid, however, that weak reference object is never removed from the callback group pointer vector. This overtime leads to memory leaks when subscriptions are added / removed dynamically.

Reproduction step is by using the multithreaded executor as well as separate regular posix threads to create new topic subscriptions. The actual code change is self explanatory.

Activity

  1. dirk-thomas commented on Aug 2, 2019

    @dirk-thomas
    Member

    Thank you for the report.

    The actual code change is self explanatory.

    Please consider to contribute a pull request.

  2. guillaumeautran commented on Aug 2, 2019

    @guillaumeautran
    ContributorAuthor

    @dirk-thomas I was too slow :) PR attached.

  3. ivanpauno commented on Aug 28, 2019

    @ivanpauno
    Member

    Closed by #814.
    Follow-up issue: #832

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions