code-iai / ROSIntegration

Unreal Engine Plugin to enable ROS Support
MIT License
411 stars 133 forks source link

Fix to avoid potential shutdown crash #178

Closed PetterVMC closed 2 years ago

PetterVMC commented 2 years ago

There was a problem in the scenario with high frequency subscription messages. If a message arrived after UROSIntegrationGameInstance::Shutdown(), it would try to trigger an invocation of a subscription callback during an unsafe topic state, causing a crash (not in the callback implementation, but in ROSIntegration). Therefore, unsubribe all topics in beginning of shutdown to ignore messages arriving after.

Also, at the same moment, unadvertise all topics.

PetterVMC commented 2 years ago

This should fix the problem also mentioned in Issue https://github.com/code-iai/ROSIntegration/issues/113

tsender commented 2 years ago

I used to handle this in all of my EndPlay() calls, but this is a nice addition. Do you think you could append to your code a function to handle unadvertising for services too?

Sanic commented 2 years ago

Thanks for the nice addition!

PetterVMC commented 2 years ago

@tsender

I used to handle this in all of my EndPlay() calls, but this is a nice addition. Do you think you could append to your code a function to handle unadvertising for services too?

Sure! I haven't used services with ROSIntegration yet though and don't have the chance to test it quickly right now. So perhaps it's best if someone that can test it would add it.