maliput / delphyne_gui

Graphical frontend and tools for Delphyne
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

maliput_viewer: Crash when hovering or selecting lanes #466

Closed francocipollone closed 3 years ago

francocipollone commented 3 years ago

Errors message:

Thread 21 "ignition::gui::" received signal SIGSEGV, Segmentation fault.
0x00007fffae8827f0 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0

Fails when:

Platforms I tried:

Note: Always same error.

Bionic + Citadel

See backtrace ``` Thread 21 "ignition::gui::" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff7ffff700 (LWP 614)] 0x00007fffae8827f0 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 (gdb) backtrace #0 0x00007fffae8827f0 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #1 0x00007fffae8828c1 in Ogre::Math::intersects(Ogre::Ray const&, Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #2 0x00007fffaef1aa18 in ignition::rendering::v3::OgreRayQuery::ClosestPoint() () from /usr/lib/x86_64-linux-gnu/ign-rendering-3/engine-plugins/libignition-rendering-ogre.so #3 0x00007fffd3dcba54 in ignition::gui::plugins::IgnRenderer::ScreenToScene(ignition::math::v6::Vector2 const&) const () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #4 0x00007fffd3dcbbe9 in ignition::gui::plugins::IgnRenderer::BroadcastHoverPos() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #5 0x00007fffd3dd4d12 in ignition::gui::plugins::IgnRenderer::HandleMouseEvent() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #6 0x00007fffd3dd4e43 in ignition::gui::plugins::IgnRenderer::Render() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #7 0x00007fffd3dd581b in ignition::gui::plugins::RenderThread::RenderNext() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #8 0x00007ffff6b110c2 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #9 0x00007ffff6ae176a in QCoreApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #10 0x00007ffff6ae18d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #11 0x00007ffff6ae404d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #12 0x00007ffff6b3b263 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #13 0x00007ffff1f4b537 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #14 0x00007ffff1f4b770 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 ```

Bionic + Fortress

See backtrace ``` Thread 25 "ignition::gui::" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff6aaab700 (LWP 21615)] 0x00007fffad0157f0 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 (gdb) backtrace #0 0x00007fffad0157f0 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #1 0x00007fffad0158c1 in Ogre::Math::intersects(Ogre::Ray const&, Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #2 0x00007fffad742e08 in ignition::rendering::v6::OgreRayQuery::ClosestPoint() () from /usr/lib/x86_64-linux-gnu/ign-rendering-6/engine-plugins/libignition-rendering-ogre.so #3 0x00007fffd32f4e64 in ignition::gui::plugins::IgnRenderer::ScreenToScene(ignition::math::v6::Vector2 const&) const () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #4 0x00007fffd32f4ff1 in ignition::gui::plugins::IgnRenderer::BroadcastHoverPos() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #5 0x00007fffd32fe422 in ignition::gui::plugins::IgnRenderer::HandleMouseEvent() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #6 0x00007fffd32fe563 in ignition::gui::plugins::IgnRenderer::Render() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #7 0x00007fffd32fef3b in ignition::gui::plugins::RenderThread::RenderNext() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #8 0x00007ffff6a0e092 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #9 0x00007ffff745983c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007ffff7461104 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #11 0x00007ffff69de8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #12 0x00007ffff69e101d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #13 0x00007ffff6a38233 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #14 0x00007ffff170e537 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 ```

Focal + Citadel

See backtrace ``` Thread 21 "ignition::gui::" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffa09c4700 (LWP 8448)] 0x00007fffc56f7f54 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 c--Type for more, q to quit, c to continue without paging-- onst&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 (gdb) backtrace #0 0x00007fffc56f7f54 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #1 0x00007fffc56f80a5 in Ogre::Math::intersects(Ogre::Ray const&, Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #2 0x00007fffc5b7fc1f in ignition::rendering::v3::OgreRayQuery::ClosestPoint() () from /usr/lib/x86_64-linux-gnu/ign-rendering-3/engine-plugins/libignition-rendering-ogre.so #3 0x00007fffe850d8ef in ignition::gui::plugins::IgnRenderer::ScreenToScene(ignition::math::v6::Vector2 const&) const () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #4 0x00007fffe85164bb in ignition::gui::plugins::IgnRenderer::HandleMouseEvent() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #5 0x00007fffe8516969 in ignition::gui::plugins::IgnRenderer::Render() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #6 0x00007fffe851724c in ignition::gui::plugins::RenderThread::RenderNext() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so #7 0x00007ffff766cd5a in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #8 0x00007ffff764093a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #9 0x00007ffff76435b8 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #10 0x00007ffff7698f67 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #11 0x00007ffff573317d in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #12 0x00007ffff5733400 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #13 0x00007ffff57334a3 in g_main_context_iteration () ```

Focal + Fortress

See backtrace ``` Thread 25 "ignition::gui::" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff82bfe700 (LWP 5221)] 0x00007fffb74faf54 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 (gdb) backtrace #0 0x00007fffb74faf54 in Ogre::Math::calculateBasicFaceNormalWithoutNormalize(Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #1 0x00007fffb74fb0a5 in Ogre::Math::intersects(Ogre::Ray const&, Ogre::Vector3 const&, Ogre::Vector3 const&, Ogre::Vector3 const&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.9.0 #2 0x00007fffc433a7bf in ignition::rendering::v6::OgreRayQuery::ClosestPoint() () from /usr/lib/x86_64-linux-gnu/ign-rendering-6/engine-plugins/libignition-rendering-ogre.so #3 0x00007fffe80b1295 in ignition::gui::plugins::IgnRenderer::ScreenToScene(ignition::math::v6::Vector2 const&) const () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #4 0x00007fffe80b1439 in ignition::gui::plugins::IgnRenderer::BroadcastHoverPos() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #5 0x00007fffe80bb0f6 in ignition::gui::plugins::IgnRenderer::HandleMouseEvent() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #6 0x00007fffe80bb229 in ignition::gui::plugins::IgnRenderer::Render() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #7 0x00007fffe80bbb1c in ignition::gui::plugins::RenderThread::RenderNext() () from /usr/lib/x86_64-linux-gnu/ign-gui-6/plugins/libScene3D.so #8 0x00007ffff7591d5a in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #9 0x00007ffff7a02a66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007ffff7a0c0f0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #11 0x00007ffff756593a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #12 0x00007ffff75685b8 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #13 0x00007ffff75bdf67 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #14 0x00007ffff4df417d in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #15 0x00007ffff4df4400 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #16 0x00007ffff4df44a3 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #17 0x00007ffff75bd565 in QEventDispatcherGlib::processEvents(QFlags) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #18 0x00007ffff75644db in QEventLoop::exec(QFlags) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #19 0x00007ffff739c785 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #20 0x00007ffff739d9d2 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #21 0x00007ffff5476609 in start_thread (arg=) at pthread_create.c:477 #22 0x00007ffff6f43293 in clone () from /usr/lib/x86_64-linux-gnu/libc.so.6 (gdb) ```
francocipollone commented 3 years ago

Related to crash in description of PR https://github.com/ToyotaResearchInstitute/delphyne_gui/pull/433

francocipollone commented 3 years ago

I've been trying to solve this crash and I might have found the way.

EDITED: See https://github.com/ToyotaResearchInstitute/delphyne_gui/issues/466#issuecomment-934879760

Old comment:

Syncing with the `QuickWindow` that emits a signal called `Qt::BeforeRendering` seems to be the way to go.
For example, [the `Grid3D` built-in plugin](https://github.com/ignitionrobotics/ign-gui/blob/242dd40ca0181e5a156225b5d4b1599ed9694b6d/src/plugins/grid_3d/Grid3D.cc#L199-L200) uses that technique also.

I've tried it locally, grouping the mesh rendering all synced with the `BeforeRendering` signal, and that solved the issue.
https://github.com/ToyotaResearchInstitute/delphyne_gui/commit/cf721fe4feef6374533431c0964eb0832e3b4e1b

We have to fix this for:
 - MaliputViewerPlugin: In this particular plugin, entities in the scene are modified from different methods.
    - For Road Meshes.
    - For Label mesehs.
    - For Lane selector.
    - For the Arrow.
    - For the TrafficLightManager.
 - OriginDisplay
 - AgentInfoDisplay
francocipollone commented 3 years ago

This https://github.com/ToyotaResearchInstitute/delphyne_gui/issues/466#issuecomment-932286396 isn't accurate. The way we are hooking to the Render event is ok and that's the recommended way.

This crashes seems to be related to the way we initialize the plugin. Plugins that needs to be fixed: