-
Notifications
You must be signed in to change notification settings - Fork 481
Description
Description
- This is a follow-up on the The
RecordIntegrationTestFixture.can_record_again_after_stoptest is tend to be flaky rosbag2#1914
We need to have the ability to disable callbacks of the subscription before freeing the shared pointer on the subscription on the application side.
Motivation
It turns out that we have an API for adding the subscription to the node. However, we don't have any API to remove it from the node, so that it will not be processed in the future.
In the client application, we may need to destroy the subscription and ensure that callbacks previously linked to the subscription will no longer be called.
However, it turns out that subscription is a shared pointer, and its callbacks are propagated to the executor and the liveliness of the subscription and its associated callbacks can't be managed directly from the client side.
In the Rosbag2 recorder, we have a scenario where we need to delete the current subscription and then create another one with the same callbacks without deleting the node itself. It could happen a situation that even though we deleted the subscription on the Rosbag2, it is still alive since it is linked to the node, executor, and callbacks called when we wouldn't expect them to be called.
Design / Implementation Considerations
On one of the Client WG meetings https://discourse.openrobotics.org/t/next-client-library-wg-meeting-friday-30th-may-2025-8am-pt/44015, these use cases were considered, and it was decided to add a new disable_callbacks() API to the SubscriptionBase class, which will disable calling any callbacks associated to the current subscription.
Additional Information
No response