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

Unhandled exception when marker contains mesh from unknown package #1589

Closed
simonschmeisser opened this issue Feb 16, 2021 · 8 comments
Closed

Comments

@simonschmeisser
Copy link
Contributor

When a marker msgs with a mesh from an unknown package is loaded, it throws an Ogre exception which is unfortunately not handled:

[ WARN] [1613474597.318764360]: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource package://motek_demo_2017/meshes/tilted-base.stl in resource group Autodetect or any other group. in ResourceGroupManager::openResource at /build/o
gre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreResourceGroupManager.cpp (line 756)                                                                                                                                                            
terminate called after throwing an instance of 'Ogre::FileNotFoundException'

  what():  OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource package://motek_demo_2017/meshes/tilted-base.stl in resource group Autodetect or any other group. in ResourceGroupManager::openResource at /build/ogre-1.9-B6QkmW/ogre-1
.9-1.9.0+dfsg1/OgreMain/src/OgreResourceGroupManager.cpp (line 756)


backtrace:


1   __GI_raise                                                                                                                                                                                                                                                                     raise.c 51 0x7f6ae9cadfb7 
2   __GI_abort                                                                                                                                                                                                                                                                     abort.c 79 0x7f6ae9caf921 
3   ??                                                                                                                                                                                                                                                                                        0x7f6aea6a2957 
4   ??                                                                                                                                                                                                                                                                                        0x7f6aea6a8ae6 
5   std::terminate()                                                                                                                                                                                                                                                                          0x7f6aea6a8b21 
6   __cxa_rethrow                                                                                                                                                                                                                                                                             0x7f6aea6a8da9 
7   Ogre::Resource::load(bool)                                                                                                                                                                                                                                                                0x7f6ae717fb08 
8   Ogre::MeshManager::load(std::string const&, std::string const&, Ogre::HardwareBuffer::Usage, Ogre::HardwareBuffer::Usage, bool, bool)                                                                                                                                                     0x7f6ae70ec0a7 
9   Ogre::EntityFactory::createInstanceImpl(std::string const&, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                     0x7f6ae7013ce6 
10  Ogre::MovableObjectFactory::createInstance(std::string const&, Ogre::SceneManager *, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)            0x7f6ae70fbd44 
11  Ogre::SceneManager::createMovableObject(std::string const&, std::string const&, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                 0x7f6ae71c477f 
12  Ogre::SceneManager::createEntity(std::string const&, std::string const&, std::string const&)                                                                                                                                                                                              0x7f6ae71c0f1a 
13  rviz::MeshResourceMarker::onNewMessage(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&, boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                              0x7f6adba6df9a 
14  rviz::MarkerBase::setMessage(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                                                                                                                           0x7f6adba6b571 
15  rviz::MarkerDisplay::processAdd(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                                                                                                                        0x7f6adba559e6 
16  rviz::MarkerDisplay::processMessage(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                                                                                                                    0x7f6adba56103 
17  rviz::MarkerDisplay::update(float, float)                                                                                                                                                                                                                                                 0x7f6adba5651f 
18  rviz::DisplayGroup::update(float, float)                                                                                                                                                                                                                                                  0x7f6aed181b88 
19  rviz::VisualizationManager::onUpdate()                                                                                                                                                                                                                                                    0x7f6aed24bb25 
20  QMetaObject::activate(QObject *, int, int, void * *)                                                                                                                                                                                                                                      0x7f6af0631305 
... <Mehr>                                                                                                                                                                                                                                                                                                   



Your environment

  • OS Version: e.g. Ubuntu 18.04
  • ROS Distro: [Kinetic | Melodic]
  • RViz, Qt, OGRE, OpenGl version as printed by rviz:
    [ INFO] [1613475494.475253896]: rviz version 1.13.15
    

[ INFO] [1613475494.475289937]: compiled against Qt version 5.12.8
[ INFO] [1613475494.475299717]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1613475494.483962728]: Forcing OpenGl version 0.
[ INFO] [1613475495.046200133]: Stereo is NOT SUPPORTED
[ INFO] [1613475495.046340502]: OpenGl version: 3,0 (GLSL 1,3).

```
  • If source build, which git commit? d4603a4

I'll try to provide a PR soon

@rhaschke
Copy link
Contributor

I'll try to provide a PR soon

Thanks.

@rhaschke
Copy link
Contributor

rhaschke commented Mar 4, 2021

I cannot reproduce the issue. In both, Melodic and Noetic, the unknown file/package is correctly reported in the display status:

image

@simonschmeisser
Copy link
Contributor Author

Strange one ... I also couldn't reproduce it in standalone rviz but it successfully crashes our UI that includes the rviz::RenderPanel

The crash also happens in InteractiveMarker

comparing rviz and the embedded use case I see that rviz prints out the following for every marker, interactive marker, robot:

[rospack] Error: package 'motek_demo_2017' not found
[librospack]: error while executing command
[ERROR] [1615826641.080096501]: Could not load resource [package://motek_demo_2017/meshes/tilted-base.stl]: Unable to open file "package://motek_demo_2017/meshes/tilted-base.stl".

while rviz embedded in our application only prints that for RobotStateDisplay but not for the interactive marker where it crashes. So I wonder why this does not fail:

if (loadMeshFromResource(new_message->mesh_resource).isNull())

Here is another backtrace:

1  __GI_raise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 raise.c      51  0x7f817c605fb7 
2  __GI_abort                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 abort.c      79  0x7f817c607921 
3  ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x7f817cffa957 
4  ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x7f817d000ae6 
5  std::terminate()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x7f817d000b21 
6  __cxa_rethrow                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               0x7f817d000da9 
7  Ogre::Resource::load(bool)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  0x7f8179ad7b08 
8  Ogre::MeshManager::load(std::string const&, std::string const&, Ogre::HardwareBuffer::Usage, Ogre::HardwareBuffer::Usage, bool, bool)                                                                                                                                                                                                                                                                                                                                                                                                                                                                       0x7f8179a440a7 
9  Ogre::EntityFactory::createInstanceImpl(std::string const&, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                                                                                                                                                                                                                                                                                                                                       0x7f817996bce6 
10 Ogre::MovableObjectFactory::createInstance(std::string const&, Ogre::SceneManager *, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                                                                                                                                                                                                                                                                                                              0x7f8179a53d44 
11 Ogre::SceneManager::createMovableObject(std::string const&, std::string const&, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0>>> const *)                                                                                                                                                                                                                                                                                                                                   0x7f8179b1c77f 
12 Ogre::SceneManager::createEntity(std::string const&, std::string const&, std::string const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x7f8179b18f1a 
13 rviz::MeshResourceMarker::onNewMessage(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&, boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                                                                                                                                                                                                                                                                                                                                                0x7f816e3c5f9a 
14 rviz::MarkerBase::setMessage(boost::shared_ptr<visualization_msgs::Marker_<std::allocator<void>> const> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             0x7f816e3c3571 
15 rviz::InteractiveMarkerControl::makeMarkers(visualization_msgs::InteractiveMarkerControl_<std::allocator<void>> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0x7f816e383be7 
16 rviz::InteractiveMarkerControl::processMessage(visualization_msgs::InteractiveMarkerControl_<std::allocator<void>> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  0x7f816e3844a0 
17 rviz::InteractiveMarker::processMessage(visualization_msgs::InteractiveMarker_<std::allocator<void>> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                0x7f816e38a9af 
18 rviz::InteractiveMarkerDisplay::updateMarkers(std::string const&, std::vector<visualization_msgs::InteractiveMarker_<std::allocator<void>>, std::allocator<visualization_msgs::InteractiveMarker_<std::allocator<void>>>> const&)                                                                                                                                                                                                                                                                                                                                                                           0x7f816e37a8cf 
19 rviz::InteractiveMarkerDisplay::updateCb(boost::shared_ptr<visualization_msgs::InteractiveMarkerUpdate_<std::allocator<void>> const>)                                                                                                                                                                                                                                                                                                                                                                                                                                                                       0x7f816e37b9b8 
20 boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, rviz::InteractiveMarkerDisplay, boost::shared_ptr<visualization_msgs::InteractiveMarkerUpdate_<std::allocator<void>> const>>, boost::_bi::list2<boost::_bi::value<rviz::InteractiveMarkerDisplay *>, boost::arg<1>>>, void, boost::shared_ptr<visualization_msgs::InteractiveMarkerUpdate_<std::allocator<void>> const> const&>::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<visualization_msgs::InteractiveMarkerUpdate_<std::allocator<void>> const> const&)                  0x7f816e37c1ca 
21 interactive_markers::SingleClient::pushUpdates()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x7f817f54ed3e 
22 interactive_markers::SingleClient::update()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 0x7f817f5503a5 
23 interactive_markers::InteractiveMarkerClient::update()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      0x7f817f545359 
24 rviz::InteractiveMarkerDisplay::update(float, float)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x7f816e377626 
25 rviz::DisplayGroup::update(float, float)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x7f817fad9b88 
26 rviz::VisualizationManager::onUpdate()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      0x7f817fba3b25 
27 QMetaObject::activate(QObject *, int, int, void * *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0x7f8182f89305 
28 QTimer::timeout(QTimer::QPrivateSignal)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0x7f8182f96237 
29 QTimer::timerEvent(QTimerEvent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           0x7f8182f96598 
30 QObject::event(QEvent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x7f8182f89e6b 
31 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0x7f81821d8e4c 
32 QApplication::notify(QObject *, QEvent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   0x7f81821e0450 
33 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      0x7f8182f597d8 
34 QTimerInfoList::activateTimers()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0x7f8182fb5cf9 
35 ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x7f8182fb64c1 
36 g_main_context_dispatch                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0x7f817ab53537 
37 ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x7f817ab53770 
38 g_main_context_iteration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x7f817ab537fc 
39 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  0x7f8182fb688f 
40 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0x7f8182f57a2a 
41 QCoreApplication::exec()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0x7f8182f60c30 
42 ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x561bb3411d23 
43 __libc_start_main                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          libc-start.c 310 0x7f817c5e8bf7 
44 ??                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0x561bb342435a 

I'm not sure how to debug this further and have some headache due to covid so I'd be grateful for ideas. I noticed that InteractiveMarker just silently ignores (from a GUI point of view) the broken markers but still it does not crash in rviz. I could not find a general purpose catch that would explain it.

@rhaschke
Copy link
Contributor

I might have an idea: Do you load the same mesh, both with rviz::Robot and InteractiveMarker?
The Robot code currently ignores the return value of loadMeshFromResource() (which should be fixed):

try
{
loadMeshFromResource(model_name);
entity = scene_manager_->createEntity(ss.str(), model_name);
}

and thus creates an invalid entity. Next time when the resource is requested, this existing but invalid entity is returned:
if (Ogre::MeshManager::getSingleton().resourceExists(resource_path))
{
return Ogre::MeshManager::getSingleton().getByName(resource_path);
}

@simonschmeisser
Copy link
Contributor Author

Good catch @rhaschke ! Now I can crash rviz as well (by enabling a PlanningSceneDisplay containing the same mesh)

Not setting the entity in RobotLink fixes the crash. Will open a PR later, maybe also with some more error reporting in the UI

@simonschmeisser
Copy link
Contributor Author

Do you see a more convenient way than adding a chain of signal/slots in RobotLink, Robot and RobotModelDisplay for actually making those resource loading errors visible in an UI/the status field? Same question for InteractiveMarkers where it looks even more complicated unfortunately

@rhaschke
Copy link
Contributor

No, I'm afraid that's the only way. I'm fine to merge #1596 as is.

@rhaschke
Copy link
Contributor

Closed via #1629.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants