calculateSimulationIslands union/find crash

User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

calculateSimulationIslands union/find crash

Post by ejtttje »

I'm having trouble with an occasional crash in calculateSimulationIslands:

Code: Select all

#0  0x004a9121 in btUnionFind::find (this=0x204dd54, x=1818322290) at btUnionFind.h:104
#1  0x004a9150 in btUnionFind::unite (this=0x204dd54, p=-1, q=4) at btUnionFind.h:80
#2  0x00611776 in btDiscreteDynamicsWorld::calculateSimulationIslands (this=0x204dc30) at /Users/ejt/todo/packages/bullet-svn/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:754
#3  0x00612e03 in btDiscreteDynamicsWorld::internalSingleStepSimulation (this=0x204dc30, timeStep=0.00999999978) at /Users/ejt/todo/packages/bullet-svn/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:381
#4  0x006133be in btDiscreteDynamicsWorld::stepSimulation (this=0x204dc30, timeStep=0.00999999978, maxSubSteps=1, fixedTimeStep=0.00999999978) at /Users/ejt/todo/packages/bullet-svn/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:342
Notice the arguments to unite are (-1,4), yet the call from unite to find() is some big integer: it should be one of those two values.

So there's a couple oddities. One is how the -1 becomes 1818322290, this isn't a straightforward wrap around. The second is why the -1 is passed to unite in the first place: since that is expected to be an index in array for find, it's going to cause trouble even if it stays -1.

Another failure mode is that NaNs pop up and are passed to graphics for object positions, where Ogre chokes with an exception. These two types of failure seem to have started occurring at the same time, so I can't help but think they are related. However they occur sporadically, so it's hard for me to tell if it was a change to my code that started this.

Thoughts? Anything I can try to test or assert() to track this down would help, thanks!
User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

Re: calculateSimulationIslands union/find crash

Post by ejtttje »

I rolled back my code to an old version and still seeing this, so I'm thinking it's something else... might be something introduced between 2.74 and 2.75, or something related to Snow Leopard...

I'd like to track this down, but a few suggestions where to start looking would help.
hyyou
Posts: 96
Joined: Wed Mar 16, 2016 10:11 am

Re: calculateSimulationIslands union/find crash

Post by hyyou »

Sorry to reply to an ancient thread, but I have found one of the causes.

It might be useful for others.

The step to produce is as followed :
1. create RigidBody X , add X to the dynamic world
2. create RigidBody Y , deliberately forget to add Y to the dynamic world
3. create Constraint C , a joint of X & Y, add C to the dynamic world
4. step simulation and expect assertion fail