Skip to content

Crash in DART updateTransmittedForceFD due to numerical overflow(assertion failure) #856

Description

@XINJIANGMO

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build?
    source , latest

Description

  • Expected behavior: not crash but warning or error msgs
  • Actual behavior: crash

Steps to reproduce

  1. gz sim -r -s crash.txt
  2. crash
    The crash occurs during the forward dynamics step. The combination of near-zero mass and near-infinite forces causes numerical overflow, resulting in NaN values for the transmitted forces. This triggers a safety assertion in BodyNode.cpp.

assertion failure in dart here.

Output

gz-sim-main: ./dart/dynamics/BodyNode.cpp:1818: virtual void dart::dynamics::BodyNode::updateTransmittedForceFD(): Assertion `!math::isNan(mF)' failed.
Stack trace (most recent call last):
#21   Object "", at 0xffffffffffffffff, in 
#20   Object "/home/momo/gz_jetty/install/libexec/gz/sim10/gz-sim-main", at 0x5ce765635ca4, in _start
#19   Source "../csu/libc-start.c", line 360, in __libc_start_main_impl [0x7cc2fb02a28a]
#18   Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main [0x7cc2fb02a1c9]
#17   Source "/home/momo/gz_jetty/src/gz-sim/src/cmd/sim_main.cc", line 578, in main [0x5ce7656403ee]
        576:       // Run the server in the main thread
        577:       sim::Server server(serverConfig);
      > 578:       server.Run(true, opt->iterations, opt->runOnStart == 0);
        579: 
        580:       gzdbg << "Shutting down gz-sim-server" << std::endl;
        581:     }
#16   Source "/home/momo/gz_jetty/src/gz-sim/src/Server.cc", line 172, in Run [0x7cc300a39745]
        169:   }
        170: 
        171:   if (_blocking)
      > 172:     return this->dataPtr->Run(_iterations);
        173: 
        174:   // Make sure two threads are not created
        175:   std::unique_lock<std::mutex> lock(this->dataPtr->runMutex);
#15   Source "/home/momo/gz_jetty/src/gz-sim/src/ServerPrivate.cc", line 204, in Run [0x7cc300aa86d2]
        201:   // simulation runner, and we can avoid using the thread pool.
        202:   if (this->simRunners.size() == 1)
        203:   {
      > 204:     result = this->simRunners[0]->Run(_iterations);
        205:   }
        206:   else
        207:   {
#14   Source "/home/momo/gz_jetty/src/gz-sim/src/SimulationRunner.cc", line 910, in Run [0x7cc300aeb264]
        907:     }
        908:     else
        909:     {
      > 910:       this->Step(this->currentInfo);
        911:     }
        912: 
        913:     // Handle Server::RunOnce(false) in which a single paused run is executed
#13   Source "/home/momo/gz_jetty/src/gz-sim/src/SimulationRunner.cc", line 971, in Step [0x7cc300aec3cc]
        968:   this->systemMgr->ProcessPendingEntitySystems();
        969: 
        970:   // Update all the systems.
      > 971:   this->UpdateSystems();
        972: 
        973:   if (!this->Paused() && this->requestedRunToSimTime &&
        974:        this->requestedRunToSimTime.value() > this->simTimeEpoch &&
#12   Source "/home/momo/gz_jetty/src/gz-sim/src/SimulationRunner.cc", line 647, in UpdateSystems [0x7cc300ae848c]
        644:     {
        645:       for (auto& system : systems)
        646:       {
      > 647:         system->Update(this->currentInfo, this->entityCompMgr);
        648:       }
        649:     }
        650:   }
#11   Source "/home/momo/gz_jetty/src/gz-sim/src/systems/physics/Physics.cc", line 1013, in Update [0x7cc2e654ea1d]
       1010:     // Only step if not paused.
       1011:     if (!_info.paused)
       1012:     {
      >1013:       stepOutput = this->dataPtr->Step(_info.dt);
       1014:     }
       1015:     auto changedLinks = this->dataPtr->ChangedLinks(_ecm, stepOutput);
       1016:     this->dataPtr->UpdateSim(_ecm, changedLinks);
#10   Source "/home/momo/gz_jetty/src/gz-sim/src/systems/physics/Physics.cc", line 3126, in Step [0x7cc2e656dbc7]
       3124:   for (const auto &world : this->entityWorldMap.Map())
       3125:   {
      >3126:     world.second->Step(output, state, input);
       3127:   }
       3128: 
       3129:   return output;
#9    Source "/home/momo/gz_jetty/install/include/gz/physics9/gz/physics/ForwardStep.hh", line 173, in Step [0x7cc2e6634d62]
        170:         public: void Step(Output &_h, State &_x, const Input &_u)
        171:         {
        172:           this->template Interface<ForwardStep>()->
      > 173:               WorldForwardStep(this->identity, _h, _x, _u);
        174:         }
        175:       };
#8    Source "/home/momo/gz_jetty/src/gz-physics/dartsim/src/SimulationFeatures.cc", line 111, in WorldForwardStep [0x7cc2dce61699]
        108:   }
        109: 
        110:   // TODO(MXG): Parse input
      > 111:   world->step();
        112: 
        113:   for (auto &[ignore, modelInfo] : this->models.idToObject)
        114:   {
#7    Object "/usr/lib/x86_64-linux-gnu/libdart.so.6.13.2", at 0x7cc2cfda9646, in dart::simulation::World::step(bool)
#6    Object "/usr/lib/x86_64-linux-gnu/libdart.so.6.13.2", at 0x7cc2cfd0a6a4, in dart::dynamics::Skeleton::computeForwardDynamics()
#5    Object "/usr/lib/x86_64-linux-gnu/libdart.so.6.13.2", at 0x7cc2cfc000c4, in dart::dynamics::BodyNode::updateTransmittedForceFD()
#4    Source "./assert/assert.c", line 105, in __assert_fail [0x7cc2fb03b516]
#3    Source "./assert/assert.c", line 96, in __assert_fail_base [0x7cc2fb02881a]
#2    Source "./stdlib/abort.c", line 79, in abort [0x7cc2fb0288fe]
#1    Source "../sysdeps/posix/raise.c", line 26, in raise [0x7cc2fb04527d]
#0  | Source "./nptl/pthread_kill.c", line 89, in __pthread_kill_internal
    | Source "./nptl/pthread_kill.c", line 78, in __pthread_kill_implementation
      Source "./nptl/pthread_kill.c", line 44, in __pthread_kill [0x7cc2fb09eb2c]
Aborted (Signal sent by tkill() 1356268 1000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions