Subscription leak when disposing TFClient while service request is ongoing

This issue has been tracked since 2021-10-27.

Description
If the TFClient is disposed while a service request to update the TF-republishing is ongoing. Then when the service call callback is called, it will resubscribe to the republished topic. Noone is using the TFClient anymore but it will stay subscribed to the republish topic, preventing the tf2_web_republisher from shutting down that republisher.

Steps To Reproduce

// We want to use the service interface
rosClient.groovyCompatibility = false;

const tfClient = new TFClient({ros: rosClient});
tfClient.subscribe('whatever', () => {})

// Only happens if the dispose call is called during the service call. So this timeout needs luck to hit the correct time. A slow backend is preferable to reproduce this issue.
setTimeout(() => { tfClient.dispose() }, 50)

Expected Behavior
No subscriptions to the republished topic

Actual Behavior
The TFClient subscribes to the topic despite already being disposed.

More Details About Repo
Owner Name RobotWebTools
Repo Name roslibjs
Full Name RobotWebTools/roslibjs
Language JavaScript
Created Date 2013-03-15
Updated Date 2022-11-22
Star Count 549
Watcher Count 54
Fork Count 340
Issue Count 66

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date