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

Solves crash on RayQuery #433

Merged
merged 6 commits into from
Jun 29, 2021
Merged

Conversation

agalbachicar
Copy link
Collaborator

@agalbachicar agalbachicar commented Jun 21, 2021

Connected to #405

Solves the crash because of using the RayQuery not in the Render thread but exposes a new error in the plugin. The following backtrace shows that it happens in the ignition::gui::Plugin instead of MaliputViewerPlugin.

This PR lacks of the correction in elevation for the double asphalt mesh. Will be fixed before marking this PR as ready for review.

Backtrace of the error:

Thread 20 "ignition::gui::" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff84859700 (LWP 22414)]
0x00007fffcc90c7f0 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  0x00007fffcc90c7f0 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  0x00007fffcc90c8c1 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  0x00007fffccfa4a18 in ignition::rendering::v3::OgreRayQuery::ClosestPoint() ()
   from /usr/lib/x86_64-linux-gnu/ign-rendering-3/engine-plugins/libignition-rendering-ogre.so
#3  0x00007fffd82c6a54 in ignition::gui::plugins::IgnRenderer::ScreenToScene(ignition::math::v6::Vector2<int> const&) const ()
   from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so
#4  0x00007fffd82c6be9 in ignition::gui::plugins::IgnRenderer::BroadcastHoverPos() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so
#5  0x00007fffd82cfd12 in ignition::gui::plugins::IgnRenderer::HandleMouseEvent() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so
#6  0x00007fffd82cfe43 in ignition::gui::plugins::IgnRenderer::Render() () from /usr/lib/x86_64-linux-gnu/ign-gui-3/plugins/libScene3D.so
#7  0x00007fffd82d081b 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
#15 0x00007ffff1f4b7fc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff6b3a88f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff6adf90a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff68fe23a in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff690317d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff3ba26db in start_thread (arg=0x7fff84859700) at pthread_create.c:463
#21 0x00007ffff5d7e71f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Steps to reproduce:

  • Open maliput_viewer2.sh
  • Select an xodr map.
  • Press the load button.
  • Drag on the empty space to move the camera around.
  • Hover (but not click) on top of the RoadGeometry a few times until the application crashes.

It can also be reproduced with yaml files.

@scpeters
Copy link
Contributor

I've also posted the BroadcastHoverPos backtrace in gazebosim/gz-gui#209 (comment)

@agalbachicar agalbachicar marked this pull request as ready for review June 28, 2021 11:11
Copy link
Collaborator

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM. Just two comments.
I will try this locally asap to confirm the same behavior as before.

/// \brief Get the maliput::api::RoadPositionResult associated with a point in
/// world space if exists.
/// \param[in] _position World position of point that intersected with a plane
/// \return maliput::api::RoadPositionResult associated with that position.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Missing throw case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved in f07e3cd

Comment on lines 582 to 585
if (renderMeshesOption.executeLabelRendering) {
RenderLabels(model->Labels());
renderMeshesOption.executeLabelRendering = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I can't figure out why this should be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Confirmed. Because of this labels aren't being rendered

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved in 1116d64

Thanks!

Comment on lines 582 to 585
if (renderMeshesOption.executeLabelRendering) {
RenderLabels(model->Labels());
renderMeshesOption.executeLabelRendering = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Confirmed. Because of this labels aren't being rendered

image

Copy link
Collaborator Author

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

All comments were addressed. PTAL.

/// \brief Get the maliput::api::RoadPositionResult associated with a point in
/// world space if exists.
/// \param[in] _position World position of point that intersected with a plane
/// \return maliput::api::RoadPositionResult associated with that position.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved in f07e3cd

Comment on lines 582 to 585
if (renderMeshesOption.executeLabelRendering) {
RenderLabels(model->Labels());
renderMeshesOption.executeLabelRendering = false;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Solved in 1116d64

Thanks!

Copy link
Collaborator

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

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

LGTM

@agalbachicar agalbachicar merged commit 94bdc34 into main Jun 29, 2021
@agalbachicar agalbachicar deleted the agalbachicar/#405_crash_on_rayquery branch June 29, 2021 12:41
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.

3 participants