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 macOS test segfaults #1728

Merged
merged 4 commits into from
Sep 22, 2022
Merged

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Sep 22, 2022

🦟 Bug fix

Summary

The segfaults happen when components are registered by plugins and component creation is attempted after the plugin that registered the component has been unloaded and it's component storage object has become invalid. Including this header insures that all components are registered by the core library ahead of any plugin.

This is a temporary solution. A better solution would be to keep track of all the plugins that have registered a component. When a plugin gets unloaded, we would unregister that component in the destructor (right before the plugin is unloaded), and check our list if there are other plugins that have registered the component. If so, we would register the component again, this time using the component storage object from a currently loaded plugin.

This is similar to #807 but has code to try to mitigate other issues. This PR targets gz-sim7 because the segfaults appear to be not flaky anymore in this branch.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey self-assigned this Sep 22, 2022
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Sep 22, 2022
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linters

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey requested a review from ahcorde September 22, 2022 16:27
@azeey azeey merged commit 6650f24 into gazebosim:gz-sim7 Sep 22, 2022
@azeey azeey deleted the fix_macos_test_segfault branch September 22, 2022 21:29
scpeters pushed a commit that referenced this pull request Nov 4, 2022
The segfaults happen when components are registered by
plugins and component creation is attempted after the
plugin that registered the component has been unloaded
and it's component storage object has become invalid.
Including this header insures that all components are
registered by the core library ahead of any plugin.

This is a temporary solution. A better solution would
be to keep track of all the plugins that have registered
a component. When a plugin gets unloaded, we would
unregister that component in the destructor (right before
the plugin is unloaded), and check our list if there are
other plugins that have registered the component. If so,
we would register the component again, this time using the
component storage object from a currently loaded plugin.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@scpeters scpeters mentioned this pull request Nov 4, 2022
8 tasks
scpeters pushed a commit that referenced this pull request Nov 4, 2022
The segfaults happen when components are registered by
plugins and component creation is attempted after the
plugin that registered the component has been unloaded
and it's component storage object has become invalid.
Including this header insures that all components are
registered by the core library ahead of any plugin.

This is a temporary solution. A better solution would
be to keep track of all the plugins that have registered
a component. When a plugin gets unloaded, we would
unregister that component in the destructor (right before
the plugin is unloaded), and check our list if there are
other plugins that have registered the component. If so,
we would register the component again, this time using the
component storage object from a currently loaded plugin.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants