Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix robotinterface plugin crashes by closing it as soon as one of its devices is destroyed #186

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

traversaro
Copy link
Member

Fix #185 .

As the destroying order of the Gazedo entities is not reversed, it occurred that the robotinterface plugin crashed as it was still calling devices that were already destroyed. This PR fixes this problem by closing the robotinterface plugin as soon as one of the devices to which it is attached is destroyed. Basically this is a port of robotology/gazebo-yarp-plugins#619 to gz-sim-yarp-plugins.

@xela-95
Copy link
Member

xela-95 commented Aug 13, 2024

Thanks a lot @traversaro!

In the corresponding PR for gazebo-yarp-plugins robotology/gazebo-yarp-plugins#619 (comment) I've seen that to check that the implementation was working as expected, you tried to remove and re-add the model without crashes. Have you tried the same here to check the implementation? We can maybe add some test to spot potential future regressions?

@robotology robotology deleted a comment from octo-reminder bot Aug 13, 2024
@traversaro
Copy link
Member Author

Thanks a lot @traversaro!

In the corresponding PR for gazebo-yarp-plugins robotology/gazebo-yarp-plugins#619 (comment) I've seen that to check that the implementation was working as expected, you tried to remove and re-add the model without crashes. Have you tried the same here to check the implementation? We can maybe add some test to spot potential future regressions?

The problem is that the problem occurs as a result of a race condition between the NWS period threads and gazebo threads. However, the test that we suppressed in #179 pass fine with this fix, so that is a sort of test for this.

@xela-95
Copy link
Member

xela-95 commented Aug 13, 2024

Just because I've mentioned it before, in gz-sim has been added the equivalent of the Gazebo Classic insert tab (for drag-and-drop of models), it is called Resource Spawner, see gazebosim/gz-sim#173 (comment)

@xela-95 xela-95 force-pushed the fixrobotinterfacecrash branch from ae2ec0f to c09a36c Compare August 13, 2024 13:52
@xela-95
Copy link
Member

xela-95 commented Aug 13, 2024

Rebased on main.

@xela-95
Copy link
Member

xela-95 commented Aug 13, 2024

Merging 🚀

@xela-95 xela-95 merged commit bdbb8b5 into main Aug 13, 2024
5 checks passed
@xela-95 xela-95 deleted the fixrobotinterfacecrash branch August 13, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Close the robotinterface has soon as one of the device attached to it is destroyed
2 participants