SofaDefrost / Cosserat

A SOFA plugin to simulate linear structures using Cosserat theory
GNU Lesser General Public License v3.0
45 stars 22 forks source link

Crash when running NeedleInsertion.py from runSofa #85

Open hugtalbot opened 1 year ago

hugtalbot commented 1 year ago

When some SOFA collaboarators try to open the NeedleInsertion.py from the GUI with the Snake, SOFA throws an error and crashes (“Segmentation fault (core dumped)”). When I load a smaller example first, e.g. the liver-file and load NeedleInsertion.py afterwards, it works.

The Plugin Manager says, that the SofaPython3 library is loaded.

Console output:

########## SIG 11 - SIGSEGV: segfault ##########

  sofa::helper::BackTrace::sig(int)

  sofa::gl::Axis::draw(sofa::type::Vec<4u, float> const&, sofa::type::Vec<4u, float> const&, sofa::type::Vec<4u, float> const&)

  sofa::gl::Axis::draw(sofa::type::Vec<3u, double> const&, sofa::type::Quat<double> const&, sofa::type::Vec<3u, double> const&, sofa::type::Vec<4u, float> const&, sofa::type::Vec<4u, float> const&, sofa::type::Vec<4u, float> const&)

  sofa::gl::DrawToolGL::drawFrame(sofa::type::Vec<3u, double> const&, sofa::type::Quat<double> const&, sofa::type::Vec<3u, float> const&)

  void sofa::component::mass::UniformMass<sofa::defaulttype::StdRigidTypes<3u, double> >::drawRigid3DImpl<sofa::defaulttype::StdRigidTypes<3u, double> >(sofa::core::visual::VisualParams const*)

  sofa::simulation::VisualVisitor::processNodeTopDown(sofa::simulation::Node*)

  sofa::simulation::VisualDrawVisitor::processNodeTopDown(sofa::simulation::Node*)

  sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal(sofa::simulation::Visitor*, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::Visitor::TreeTraversalRepetition, bool)

  sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal(sofa::simulation::Visitor*, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::Visitor::TreeTraversalRepetition, bool)

  sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal(sofa::simulation::Visitor*, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::Visitor::TreeTraversalRepetition, bool)

  sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal(sofa::simulation::Visitor*, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::Visitor::TreeTraversalRepetition, bool)

  sofa::simulation::graph::DAGNode::executeVisitorTreeTraversal(sofa::simulation::Visitor*, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::Visitor::TreeTraversalRepetition, bool)

  sofa::simulation::graph::DAGNode::doExecuteVisitor(sofa::simulation::Visitor*, bool)

  sofa::simulation::DefaultVisualManagerLoop::drawStep(sofa::core::visual::VisualParams*)

  sofa::simulation::Simulation::draw(sofa::core::visual::VisualParams*, sofa::simulation::Node*)

  sofa::gui::qt::viewer::qgl::QtGLViewer::DisplayOBJs()

  sofa::gui::qt::viewer::qgl::QtGLViewer::drawScene()

  sofa::gui::qt::viewer::qgl::QtGLViewer::draw()

  QGLViewer::paintGL()

  QWidget::event(QEvent*)

  QApplicationPrivate::notify_helper(QObject*, QEvent*)

  QCoreApplication::notifyInternal2(QObject*, QEvent*)

  QWidgetPrivate::sendPaintEvent(QRegion const&)

  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*)

  QWidget::event(QEvent*)

  QApplicationPrivate::notify_helper(QObject*, QEvent*)

  QCoreApplication::notifyInternal2(QObject*, QEvent*)

  QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)

  g_main_context_dispatch

  g_main_context_iteration

  QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)

  QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)

  QCoreApplication::exec()

  sofa::gui::qt::RealGUI::mainLoop()

  sofa::gui::common::GUIManager::MainLoop(boost::intrusive_ptr<sofa::simulation::Node>, char const*)

  __libc_start_main

Segmentation fault (core dumped)
adagolodjo commented 1 year ago

It looks like he is dealing with a segmentation fault (SIGSEGV) in his code, which indicates that the program accessed a memory location it wasn't supposed to. Use debugging tools like gdb (for instancegdb runSofa myscene.py) to analyse the crash. We will have more information about the origin of the problem. Running your program with gdb and examining the backtrace can provide more insights into where the crash occurs. You can also use tools like valgrind to detect memory-related errors.

alxbilger commented 1 year ago

Hey @hugtalbot,

you did not mention the version of SOFA. On the current master branch, I cannot reproduce the crash. If there is a fix for that problem, I would bet on this PR since it is related on your callstack. Maybe an update of SOFA would solve the problem.

hugtalbot commented 1 year ago

I unfortunately do not have this information yet since it's not my issue but a partner from the community. I will let you know as soon as I have more to share for reproductability