cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.19k stars 1.67k forks source link

Crash (segfault) when boundingObject Group contains Solid with physics #6414

Open PeterJCLaw opened 10 months ago

PeterJCLaw commented 10 months ago

Describe the Bug

Launching webots R2023b with the following world results in some warnings and a segfault. This world is a cut-down. I hit this while developing the larger world, which doesn't normally have warnings but did in the failure mode.

The warnings in the original world before the cut-down was just:

Pose: A Pose node inside a 'boundingObject' can only contain one Shape or one Geometry node. The child node is ignored.

and then a line like:

/usr/local/bin/webots: line 105: 33888 Segmentation fault      (core dumped) "$webots_home/bin/webots-bin" "$@"

The warnings observed in the cut-down are different, so I'm not completely sure if the cause is the same.

Steps to Reproduce

$ webots --stdout --stderr --mode=pause $PWD/worlds/Arena.wbt

Arena.wbt:

#VRML_SIM R2022b utf8

WorldInfo {
  basicTimeStep 8
}
Viewpoint {}

Solid {
  name "outer"
  children [
    DEF BODY Group {
      children [
        Solid {
          name "inner"
          physics Physics {}
        }
      ]
    }
  ]
  boundingObject USE BODY
  physics Physics {}
}

Removing either physics node or the boundingObject avoids the crash.

Expected behavior

For other invalid worlds webots seems to emit warnings and refuse to run a simulation, but not crash. Matching that would be fine.

System

ShuffleWire commented 6 months ago

I don't know what your use case is, but I've been playing lately with Solid into Solid (especially with physic for each of them), and in the end, even if the simulation "could" work on smaller system, it doesn't scaled well and give many weird behavior (the internal solver seems to struggle to follows relationship and so on...) I would advice (and it's what I've done, and happy with that) to stick to the Solid -> Joint -> Solid architecture, which Webots is much happier to work with. Anyway, Webots should not crash, but in the end even it didn't I would not be confident in my simulation setup. My two cents

ShuffleWire commented 4 months ago

An assertion if falling

#5  0x00007fb24a053eb2 in __GI___assert_fail
    (assertion=0x559f33c90e3c "mIsKinematic || mSolidMerger", file=0x559f33c906fc "nodes/WbSolid.cpp", line=1173, function=0x559f33c90e18 "dxBody* WbSolid::bodyMerger() const")
    at ./assert/assert.c:101

I'm adding a trace of the crash

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007fb24a0a9e8f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x00007fb24a05afb2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fb24a045472 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007fb24a045395 in __assert_fail_base
    (fmt=0x7fb24a1b9a90 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x559f33c90e3c "mIsKinematic || mSolidMerger", file=file@entry=0x559f33c906fc "nodes/WbSolid.cpp", line=line@entry=1173, function=function@entry=0x559f33c90e18 "dxBody* WbSolid::bodyMerger() const") at ./assert/assert.c:92
#5  0x00007fb24a053eb2 in __GI___assert_fail
    (assertion=0x559f33c90e3c "mIsKinematic || mSolidMerger", file=0x559f33c906fc "nodes/WbSolid.cpp", line=1173, function=0x559f33c90e18 "dxBody* WbSolid::bodyMerger() const")
    at ./assert/assert.c:101
#6  0x0000559f3397f100 in WbSolid::bodyMerger() const (this=0x559f3bb38860) at nodes/WbSolid.cpp:1173
#7  0x0000559f33986778 in WbSolid::displayWarning() (this=0x559f3bb38860) at nodes/WbSolid.cpp:2716
#8  0x0000559f3397aaec in WbSolid::postFinalize() (this=0x559f3bb38860) at nodes/WbSolid.cpp:487
#9  0x0000559f33798cea in WbGroup::recomputeBoundingSphere() (this=0x559f3c4a9800) at nodes/WbGroup.cpp:129
#10 0x0000559f33798700 in WbGroup::postFinalize() (this=0x559f3c4a9800) at nodes/WbGroup.cpp:98
#11 0x0000559f3381ef9d in WbMatter::postFinalize() (this=0x559f3e456c60) at nodes/WbMatter.cpp:132
#12 0x0000559f3397a4a2 in WbSolid::postFinalize() (this=0x559f3e456c60) at nodes/WbSolid.cpp:456
#13 0x0000559f33798cea in WbGroup::recomputeBoundingSphere() (this=0x559f35ae9c30) at nodes/WbGroup.cpp:129
#14 0x0000559f33798700 in WbGroup::postFinalize() (this=0x559f35ae9c30) at nodes/WbGroup.cpp:98
#15 0x0000559f336c9b39 in WbBaseNode::finalize() (this=0x559f35ae9c30) at nodes/WbBaseNode.cpp:118
#16 0x0000559f3395eeec in WbSimulationWorld::WbSimulationWorld(WbTokenizer*) (this=0x559f3e4bb7c0, tokenizer=0x7ffe73628a90) at engine/WbSimulationWorld.cpp:105
#17 0x0000559f3372ac30 in WbControlledWorld::WbControlledWorld(WbTokenizer*) (this=0x559f3e4bb7c0, tokenizer=0x7ffe73628a90) at control/WbControlledWorld.cpp:44
#18 0x0000559f3369c006 in WbApplication::loadWorld(QString, bool, bool) (this=0x559f35ba1c00, worldName=..., reloading=false, isLoadingAfterDownload=true) at app/WbApplication.cpp:288
#19 0x0000559f3369e6d5 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<QString const&, bool, bool>, void, void (WbApplication::*)(QString, bool, bool)>::call(void (WbApplication::*)(QString, bool, bool), WbApplication*, void**)
    (f=(void (WbApplication::*)(class WbApplication * const, class QString, bool, bool)) 0x559f3369b4de <WbApplication::loadWorld(QString, bool, bool)>, o=0x559f35ba1c00, arg=0x7ffe736291b0) at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:135
#20 0x0000559f3369e1ad in QtPrivate::FunctionPointer<void (WbApplication::*)(QString, bool, bool)>::call<QtPrivate::List<QString const&, bool, bool>, void>(void (WbApplication::*)(QString, bool, bool), WbApplication*, void**)
    (f=(void (WbApplication::*)(class WbApplication * const, class QString, bool, bool)) 0x559f3369b4de <WbApplication::loadWorld(QString, bool, bool)>, o=0x559f35ba1c00, arg=0x7ffe736291b0) at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:172
#21 0x0000559f3369dd7f in QtPrivate::QSlotObject<void (WbApplication::*)(QString, bool, bool), QtPrivate::List<QString const&, bool, bool>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x559f3e3aa480, r=0x559f35ba1c00, a=0x7ffe736291b0, ret=0x0) at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:383
#22 0x00007fb24cf97772 in  () at /home/yann/webots/lib/webots/libQt6Core.so.6
#23 0x0000559f33b804e5 in WbProtoManager::worldLoadCompleted(QString const&, bool, bool) (this=0x559f360e8250, _t1=..., _t2=false, _t3=true) at build/debug/WbProtoManager.moc.cpp:203
#24 0x0000559f338d41be in WbProtoManager::loadWorld() (this=0x559f360e8250) at vrml/WbProtoManager.cpp:418
#25 0x0000559f338df79f in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (WbProtoManager::*)()>::call(void (WbProtoManager::*)(), WbProtoManager*, void**)
    (f=(void (WbProtoManager::*)(class WbProtoManager * const)) 0x559f338d3d84 <WbProtoManager::loadWorld()>, o=0x559f360e8250, arg=0x7ffe736293d0)
    at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:135
#26 0x0000559f338dd6d5 in QtPrivate::FunctionPointer<void (WbProtoManager::*)()>::call<QtPrivate::List<>, void>(void (WbProtoManager::*)(), WbProtoManager*, void**)
    (f=(void (WbProtoManager::*)(class WbProtoManager * const)) 0x559f338d3d84 <WbProtoManager::loadWorld()>, o=0x559f360e8250, arg=0x7ffe736293d0)
    at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:172
--Type <RET> for more, q to quit, c to continue without paging--
#27 0x0000559f338dc225 in QtPrivate::QSlotObject<void (WbProtoManager::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x559f35d89930, r=0x559f360e8250, a=0x7ffe736293d0, ret=0x0) at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:383
#28 0x00007fb24cf97772 in  () at /home/yann/webots/lib/webots/libQt6Core.so.6
#29 0x0000559f33b80985 in WbProtoTreeItem::finished() (this=0x7fb24000dda0) at build/debug/WbProtoTreeItem.moc.cpp:153
#30 0x0000559f338f0100 in WbProtoTreeItem::readyCheck() (this=0x7fb24000dda0) at vrml/WbProtoTreeItem.cpp:177
#31 0x0000559f338ef6b2 in WbProtoTreeItem::parseItem() (this=0x7fb24000dda0) at vrml/WbProtoTreeItem.cpp:113
#32 0x0000559f338efdc8 in WbProtoTreeItem::download() (this=0x7fb24000dda0) at vrml/WbProtoTreeItem.cpp:147
#33 0x0000559f338d3594 in WbProtoManager::retrieveExternProto(QString const&, bool) (this=0x559f360e8250, filename=..., reloading=false) at vrml/WbProtoManager.cpp:346
#34 0x0000559f3369b670 in WbApplication::loadWorld(QString, bool, bool) (this=0x559f35ba1c00, worldName=..., reloading=false, isLoadingAfterDownload=false) at app/WbApplication.cpp:211
#35 0x0000559f337f940a in WbMainWindow::loadWorld(QString const&, bool) (this=0x559f35be9240, fileName=..., reloading=false) at gui/WbMainWindow.cpp:1319
#36 0x0000559f337f9d81 in WbMainWindow::openWorld() (this=0x559f35be9240) at gui/WbMainWindow.cpp:1405
#37 0x0000559f338162fa in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (WbMainWindow::*)()>::call(void (WbMainWindow::*)(), WbMainWindow*, void**)
    (f=(void (WbMainWindow::*)(class WbMainWindow * const)) 0x559f337f9c70 <WbMainWindow::openWorld()>, o=0x559f35be9240, arg=0x7ffe7362a340)
    at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:135
#38 0x0000559f338138ab in QtPrivate::FunctionPointer<void (WbMainWindow::*)()>::call<QtPrivate::List<>, void>(void (WbMainWindow::*)(), WbMainWindow*, void**)
    (f=(void (WbMainWindow::*)(class WbMainWindow * const)) 0x559f337f9c70 <WbMainWindow::openWorld()>, o=0x559f35be9240, arg=0x7ffe7362a340)
    at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:172
#39 0x0000559f338106fb in QtPrivate::QSlotObject<void (WbMainWindow::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x559f35f0f380, r=0x559f35be9240, a=0x7ffe7362a340, ret=0x0) at ../../include/qt/QtCore/QtCore/qobjectdefs_impl.h:383
#40 0x00007fb24cf97772 in  () at /home/yann/webots/lib/webots/libQt6Core.so.6
#41 0x00007fb24c988602 in QAction::triggered(bool) () at /home/yann/webots/lib/webots/libQt6Gui.so.6
#42 0x00007fb24c98b3b9 in QAction::activate(QAction::ActionEvent) () at /home/yann/webots/lib/webots/libQt6Gui.so.6
#43 0x00007fb24bf34635 in  () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#44 0x00007fb24bf3c063 in  () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#45 0x00007fb24bdcc448 in QWidget::event(QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#46 0x00007fb24bd76f62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#47 0x00007fb24bd7f8d8 in QApplication::notify(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#48 0x00007fb24cf38fda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Core.so.6
#49 0x00007fb24bf3cf12 in  () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#50 0x00007fb24bf3d1f6 in QMenu::mouseReleaseEvent(QMouseEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#51 0x00007fb24bdcc448 in QWidget::event(QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#52 0x00007fb24bd76f62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#53 0x00007fb24bd7f8d8 in QApplication::notify(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#54 0x00007fb24cf38fda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Core.so.6
#55 0x00007fb24bd7ec40 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) ()
    at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#56 0x00007fb24bdde935 in  () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#57 0x00007fb24bde0a5b in  () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#58 0x00007fb24bd76f62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Widgets.so.6
#59 0x00007fb24cf38fda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /home/yann/webots/lib/webots/libQt6Core.so.6
#60 0x00007fb24c5bd500 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /home/yann/webots/lib/webots/libQt6Gui.so.6
#61 0x00007fb24c60f0dc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /home/yann/webots/lib/webots/libQt6Gui.so.6
--Type <RET> for more, q to quit, c to continue without paging--
#62 0x00007fb247155aca in  () at /home/yann/webots/lib/webots/libQt6XcbQpa.so.6
#63 0x00007fb24ad1c7a9 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#64 0x00007fb24ad1ca38 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#65 0x00007fb24ad1cacc in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#66 0x00007fb24d1df90a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /home/yann/webots/lib/webots/libQt6Core.so.6
#67 0x00007fb24cf44c9b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /home/yann/webots/lib/webots/libQt6Core.so.6
#68 0x00007fb24cf4107e in QCoreApplication::exec() () at /home/yann/webots/lib/webots/libQt6Core.so.6
#69 0x0000559f337a002c in WbGuiApplication::exec() (this=0x7ffe7362b520) at gui/WbGuiApplication.cpp:288
#70 0x0000559f33a84a0e in main(int, char**) (argc=1, argv=0x7ffe7362b948) at gui/main.cpp:214