It's possible that subscription data could arrive just as a GravityNode is being deleted. The GravityNode destructor sends a request to kill the SubscriptionManager, but doesn't wait for the manager thread to respond to the request. In this situation, it's possible that the sub manager thread could be processing incoming data (which would block the kill command from being processed), but GravityNode deletion would still complete.
Note that calling GravityNode::unsubscribe does not solve the issue because the unsubscribe call returns without receiving confirmation that the sub manager has deleted the subscription.
I see a couple possible solutions here:
- Require the GravityNode user to
unsubscribe and unregister everything before deleting a node. This could be cumbersome to use, but seems like the cleanest option
- Have the
GravityNode destructor wait for a response from each manager thread before returning. This might be the safest catch-all, but it could be problematic to be ready to handle callbacks while the GravityNode is being deleted.
The most complete solution may require both of these.
cc @kguilbert
It's possible that subscription data could arrive just as a
GravityNodeis being deleted. TheGravityNodedestructor sends a request tokilltheSubscriptionManager, but doesn't wait for the manager thread to respond to the request. In this situation, it's possible that the sub manager thread could be processing incoming data (which would block thekillcommand from being processed), butGravityNodedeletion would still complete.Note that calling
GravityNode::unsubscribedoes not solve the issue because the unsubscribe call returns without receiving confirmation that the sub manager has deleted the subscription.I see a couple possible solutions here:
unsubscribeand unregister everything before deleting a node. This could be cumbersome to use, but seems like the cleanest optionGravityNodedestructor wait for a response from each manager thread before returning. This might be the safest catch-all, but it could be problematic to be ready to handle callbacks while theGravityNodeis being deleted.The most complete solution may require both of these.
cc @kguilbert