Max constraint count

Hey,

We have an asset on which we consistently run into a maya crash while building the rig. After debugging, I’ve managed to track it down to the 361st distance constraint being created in the scene (when skipping the constraint part, I can create thousands of markers). I have both the stack trace, as well as code to reproduce the error below. Assuming this is not a feature, is there a known workaround?

Thanks,
Dominik

from ragdoll import commands as ragCmds
from ragdoll.vendor import cmdx

cmds.loadPlugin("ragdoll")

solver = ragCmds.create_solver()
last = None
for i in range(370):
    new = ragCmds.assign_marker(cmdx.encode(cmds.polyCube(ch=False)[0]), solver=solver)
    if last:
        print(i)
        ragCmds.create_distance_constraint(last, new)
    last = new
Stack trace:
  physx::NpShape* physx::NpFactory::createShapeInternal<physx::PxMaterial, physx::NpMaterial>(physx::PxGeometry const&, physx::PxFlags<physx::PxShapeFlag::Enum, unsigned char>, physx::PxMaterial* const*, unsigned short, bool, physx::PxShapeCoreFlag::Enum)
  physx::NpFactory::createShape(physx::PxGeometry const&, physx::PxFlags<physx::PxShapeFlag::Enum, unsigned char>, physx::PxMaterial* const*, unsigned short, bool)
  physx::NpPhysics::createShape(physx::PxGeometry const&, physx::PxMaterial* const*, unsigned short, bool, physx::PxFlags<physx::PxShapeFlag::Enum, unsigned char>)
  ../Ragdoll-2023_12_13/plug-ins/linux/2022/ragdoll.so(+0x5165db) [0x7f74dcba45db]
  ../Ragdoll-2023_12_13/plug-ins/linux/2022/ragdoll.so(+0x51f070) [0x7f74dcbad070]
 ../Ragdoll-2023_12_13/plug-ins/linux/2022/ragdoll.so(+0x527787) [0x7f74dcbb5787]
  void entt::basic_dispatcher<std::allocator<void> >::trigger<Ragdoll::RdRigidChangedEvent&>(unsigned int, Ragdoll::RdRigidChangedEvent&)
  void Ragdoll::RdEmit<Ragdoll::RdRigidChangedEvent>(Ragdoll::RdRigidChangedEvent)
  Ragdoll::PostProcess::Rigids(entt::entity)
  Ragdoll::SolverSystem::computeStartState(entt::entity)
  SolverNode::computeStartState(Autodesk::Maya::OpenMaya20220000::MPlug const&, Autodesk::Maya::OpenMaya20220000::MDataBlock&)
  SolverNode::compute(Autodesk::Maya::OpenMaya20220000::MPlug const&, Autodesk::Maya::OpenMaya20220000::MDataBlock&)
  THsurfaceShape::computePlug(Tplug const&, TdataBlock&)
  TdependNode::dbEvaluate(TmsgEval&)
  TdagObject::dbEvaluate(TmsgEval&)
  TdependNode::mpSafeDbEvaluateWithSet(TmsgEval&)
  Tplug::getValue(TdataHandle&, TdataBlock const&, bool, bool, bool) const
  Tplug::getValue(TdataHandle&, TdgContext const&) const
  TdependNode::getPlugValue(Tplug const&, TdataHandle&, TdgContext const&)
  TdependNode::processMessage(Tmsg&)
  TdagObject::processMessage(Tmsg&)
  TmsgPlugValue::send()
  Autodesk::Maya::OpenMaya20220000::MPlug::asInt(Autodesk::Maya::OpenMaya20220000::MStatus*) const
  InfoCommand::doIt(Autodesk::Maya::OpenMaya20220000::MArgList const&)
  THcommandObject::doIt(TargList&)
  TmetaCommand::doCommand(TargList&)
  TpythonInterpreter::dispatchMayaCommand(TmetaCommand&, _object*, _object*)
  TpythonInterpreter::genericDispatchFunction(_object*, _object*, _object*)
  PyCFunction_Call
  _PyEval_EvalFrameDefault
  _PyEval_EvalCodeWithName
  _PyFunction_FastCallKeywords
  _PyEval_EvalFrameDefault
  /usr/autodesk/maya2022/bin/../lib/libpython3.7m.so.1.0(+0x68590) [0x7f7677468590]
  _PyEval_EvalFrameDefault
  _PyEval_EvalCodeWithName
  _PyFunction_FastCallDict
  _PyEval_EvalFrameDefault
  _PyEval_EvalCodeWithName
  _PyFunction_FastCallKeywords
1Result: ../scene.ma
Fatal Error. Attempting to save in /usr/tmp/dominik.20240528.0813.ma

Hey @dominik, there is no max constraint count, but double-check that this constraint has both a parent and child Marker plugged in. If a distance constraint is missing parent or child it’s possible it may crash in the latest and previous versions.

That said, the error message looks unrelated to the distance constraint. It instead looks related to a mesh shape being unable to convert into a convex hull. Try either replacing the geometry plugged into this Marker, or setting the Marker to a different shape type, like a Capsule.

I added new["shapeType"] = 2 but the issue remains. The cubes in the example code are all the same.
Opening the crash file, I can see that both child and parent marker plugs are connected.
In our rig, I was able to skip some constraints and therefore push the limit (eg I started at 10, and it would error at 371 instead of 361). I cant fully reproduce this with the test code though. For example if I iterate 500 times and set a condition if last and i > 100, The constraint that errors is 254 (index 354). That is will all identical cubes and shapeType set to 2.

from ragdoll import commands as ragCmds
from ragdoll.vendor import cmdx

cmds.loadPlugin("ragdoll")

solver = ragCmds.create_solver()
last = None
for i in range(370):
    new = ragCmds.assign_marker(cmdx.encode(cmds.polyCube(ch=False)[0]), solver=solver)
    new["shapeType"] = 2
    if last and i > 100:
        print(i)
        ragCmds.create_distance_constraint(last, new)
    last = new

What version of Ragdoll is this?

Here’s what your script gets me in 2024.05.07, after cranking up substeps and increasing the stiffness on the constraints.

This is 2023.12.13.
Oh interesting! So the script runs through on your end! I get the maya crash while running the script, I dont even get to the simulation step. I will need to do some further testing.
I am reading physx, is that the Nvidia PhysX? Do you think this could be driver related? I believe we are on an older version for Redshift.
I’ll also test with 2024.05.07 and see if the issue persists.

It is not related to any driver. PhysX is used to compute the convex hull from your meshes, but it’s a common misconception that it involves drivers because it used to be hardware accelerated with custom physics hardware. Some games even ship with PhysX drivers, but it’s 10-20 years out of date by now.

Let me know how it goes.

I bring news!
2024.05.15 gives me the same error as 2023.10.3. But I also went back and tried 2023.04.08 which I thought we used previously on a similar asset, and that worked!!

I just tried this on my windows machine as well and 2024.04.08 works fine. I wanted to try the previous versions as well but this page does not like my forum credentials.
This could be an issue with the newer versions for linux specifically…
We are on Rocky 8.5 and I tried Maya 2022.1 and 2022.5 on linux and 2022.3 on windows (what a mess, I know!). The common denominator with the crashes seems to be linux.

Hm, I’ll get back to you on this, getting myself Maya 2022 on a Linux box with a GPU to test. You can copy your Linux versions for use on Windows too, the modules directory contains Ragdoll for all platforms.

1 Like