-
Notifications
You must be signed in to change notification settings - Fork 486
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
gzclient shutdown segmentation fault with ogre 1.10 #2324
Comments
Original comment by Tim Rakowski (Bitbucket: Tim Rakowski).
|
2 similar comments
Original comment by Tim Rakowski (Bitbucket: Tim Rakowski).
|
Original comment by Tim Rakowski (Bitbucket: Tim Rakowski).
|
Original comment by Tim Rakowski (Bitbucket: Tim Rakowski). Done: https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2761 |
Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).
Fixed issue #2324 Ogre::Root::shutdown followed by Ogre::Root::~Root leads to a → <<cset 27992b0>> |
Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033). Merged in tim_rakowski/gazebo/gazebo8_ogre_1.10_shutdown_segfault_fix (pull request #2761) Fixed issue #2324 Approved-by: Ian Chen ichen@osrfoundation.org → <<cset ef73f34>> |
Original report (archived issue) by Tim Rakowski (Bitbucket: Tim Rakowski).
The original report had attachments: ogre-1.10.patch
This issue is related to https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/issues/2321/gazebo-800-startup-error-on-arch-linux. (#2321) I used both patches referenced by @iche033. Just to make sure, I attached the actual patch I used.
Here is the gazebo code causing the seg fault:
https://github.com/osrf/gazebo/blob/06333d5dbdf94f2e09eae8f8a6f8e2bacb3f0455/gazebo/rendering/RenderEngine.cc#L354
Calling Ogre::Root::~Root after calling Ogre::Root::shutdown seems to fail. Which is not documented, so either Ogre should fix it or it may be caused by something else gazebo does.
I think that the this-pointer in the SceneManagerEnumerator::shutdown call (called from Root::~Root) is 0, but I honestly was not able to figure out how this can be caused by "Root::~Root followed by Root::shutdown":
Possible Solution
According to https://bitbucket.org/sinbad/ogre/src/695d30368b416df2f90d570f747e4c656e0462f3/OgreMain/src/OgreRoot.cpp?at=v1-8&fileviewer=file-view-default#OgreRoot.cpp-288,
Ogre::Root::~Root calls Ogre::Root::shutdown, so you might as well remove the shutdown call, which fixes the issue in my tests.
Edit
In hindsight I did the obvious thing and created the smallest test possible to show that Root::shutdown followed by Root::~Root leads to seg fault:
Edit 2
I was able to find the (actually quite obvious) root cause:
https://bitbucket.org/sinbad/ogre/src/b42cf1abf81571baaefd7c6b92ebfd701896686f/OgreMain/src/OgreRoot.cpp?at=v1-10-5&fileviewer=file-view-default#OgreRoot.cpp-1030
So calling Root::shutdown once deletes mSceneManagerEnum, and calling it a second time will access it again. Generally, Root::shutdown must not be called twice to prevent double deletes ... But this really looks like a Ogre issue since it isn't documented.
I created a ticket for this in the Ogre JIRA: https://ogre3d.atlassian.net/browse/OGRE-576
The text was updated successfully, but these errors were encountered: