Skip to content

Unsubscribe from topic safely #105

Closed

Description

@jacobperron

Currently, there is no safe way to unsubscribe from a topic. If the user calls dispose() on a Subscription, then it will destroy the native subscription (effectively unsubscribing), but the Node is not aware of the subscriptions disposal. E.g. getSubscriptions will return disposed subscriptions that may be accessed by executors leading an exception:

org.ros2.rcljava.exceptions.RCLException: Failed to add subscription to wait set

I think we need a way to safely remove Subscription (and Publisher) objects from a node. Whether that is through the existing Disposable interface or API added to the node (e.g. removeSubscription).

Implementation considerations

I think having the node detect when a subscription has been disposed (perhaps using WeakReference) would be nice as I don't think it would require additional API.

Activity

  1. self-assigned this
    on Jun 8, 2020
  2. added 2 commits that reference this issue on Jun 8, 2020
    c8ae3e7
    729eeab
  3. added a commit that references this issue on Jun 24, 2020
    b16be6c
  4. added a commit that references this issue on Jun 30, 2020
    cf2ef07
  5. jacobperron commented on Jul 29, 2020

    @jacobperron
    ContributorAuthor

    This was fixed in #110

  6. esteve commented on Jul 29, 2020

    @esteve
    Member

    @jacobperron thanks for catching that!

  7. added 2 commits that reference this issue on May 17, 2021
    d270e67
    31a6bac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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