MultiThreaded Bullet Crashes

skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

MultiThreaded Bullet Crashes

Post by skeen »

Note: Somewhat follow up on: Linker errors (BulletMultiThreaded)

Okay, so I got my application to link now, and its able to boot and everything, and it runs, till Bullet has to deal with the first collision, thats when it bugs.

Running gdb shows the following:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 11720.0xe08]
0x00421632 in CustomSetupContactConstraintsTask(PfxSortData16*, unsigned int, TrbState*, PfxSol
verBody*, unsigned int, float, float) ()
(gdb) backtrace
#0  0x00421632 in CustomSetupContactConstraintsTask(PfxSortData16*, unsigned int, TrbState*, Pf
xSolverBody*, unsigned int, float, float) ()
#1  0x0042187e in SolverThreadFunc(void*, void*) ()
#2  0x00424c1d in Thread_no_1 ()
#3  0x77273677 in KERNEL32!BasepMapModuleHandle () from C:\Windows\syswow64\kernel32.dll
#4  0x04a1c8e8 in ?? ()
#5  0x77b29d42 in ntdll!RtlpNtQueryValueKey () from C:\Windows\system32\ntdll.dll
#6  0x77b29d15 in ntdll!RtlpNtQueryValueKey () from C:\Windows\system32\ntdll.dll
#7  0x00000000 in ?? ()
The way I initialize the MultiThreaded stuff, is exactly the same as in the MultiThreaded Demo, however I'm not having my objects in a: 'btAlignedObjectArray', so heres the one million question; Is it required to store ones objects this way, for the MultiThreaded Bullet to work?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: MultiThreaded Bullet Crashes

Post by Erwin Coumans »

Could you try using Microsoft Visual Studio 2008 (free version) and provide a full callstack with line numbers?

Does the multithreaded demo work fine for you? Are there just contacts or also non-contact joints (such as point to point, hinge etc)?
Thanks,
Erwin
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

Erwin Coumans wrote: Could you try using Microsoft Visual Studio 2008 (free version) and provide a full callstack with line numbers?

Does the multithreaded demo work fine for you? Are there just contacts or also non-contact joints (such as point to point, hinge etc)?
Thanks,
Erwin
First of all: As far as possible I would love to avoid Microsoft Visual Studio (it takes ages to uninstall, due to it installing like a million different useless things (useless to me anyway)).
Secondly: The Engine we're developing doesn't compile using Visual Studio.

As for the Multithreaded demo, it does work perfectly, and I havn't checked joins and such, only contacts.

As for the trace, I'm unable to supply you with such one, due to the thingy being threaded.

My current demo is dropping spheres onto a Trimesh:

Image
Image
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

Changing the 'createSolverThreadSupport', from 'Win32ThreadSupport' to 'SequentialThreadSupport', yields the following stacktrace:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x00421ca7 in btSetupContactConstraint(PfxConstraintRow&, PfxConstraintRow&, PfxConstraintRow&, float, float, float, Vectormath::Aos::Vector3 const&, Vectormath::Aos::Vector3 const&, Vectormath::Aos::Vector3 const&, TrbState const&, TrbState const&, PfxSolverBody&, PfxSolverBody&, float, float) ()

(gdb) backtrace
#0  0x00421ca7 in btSetupContactConstraint(PfxConstraintRow&, PfxConstraintRow&, PfxConstraintRow&, float, float, float, Vectormath::Aos::Vector3 const&, Vectormath::Aos::Vector3 const&, Vectormath::Aos::Vector3 const&, TrbState const&, TrbState const&, PfxSolverBody&, PfxSolverBody&, float, float) ()
#1  0x00422206 in CustomSetupContactConstraintsTask(PfxSortData16*, unsigned int, TrbState*, PfxSolverBody*, unsigned int, float, float) ()
#2  0x0042234e in SolverThreadFunc(void*, void*) ()
#3  0x0042417e in btParallelConstraintSolver::solveGroup(btCollisionObject**, int, btPersistentManifold**, int, btTypedConstraint**, int, btContactSolverInfo const&, btIDebugDraw*, btStackAlloc*, btDispatcher*) ()
#4  0x00434f45 in btDiscreteDynamicsWorld::solveConstraints(btContactSolverInfo&) ()
#5  0x00431ce7 in btDiscreteDynamicsWorld::internalSingleStepSimulation(float) ()
#6  0x0042fbaa in btDiscreteDynamicsWorld::stepSimulation(float, int, float) ()
//ABOVE = BULLET
//BELOW = OUR ENGINE

Code: Select all

#7  0x004102e2 in OpenEngine::Bullet::BulletEngine::Process (this=0x325ce8, deltaTime=26601)
    at Bullet\BulletEngine.cpp:304
#8  0x0040eedc in OpenEngine::Physics::PhysicsFacade::Handle (this=0x325cc0, arg=...)
    at Physics\PhysicsFacade.cpp:35
#9  0x00638fc1 in OpenEngine::Core::Event<OpenEngine::Core::ProcessEventArg>::Notify (this=0x3248ec, arg=...)
    at Core/Event.h:56
#10 0x004be783 in OpenEngine::Core::Engine::StartMainLoop (this=0x3248d8)
    at Core\Engine.cpp:55
#11 0x004be8bb in OpenEngine::Core::Engine::Start (this=0x3248d8)
    at Core\Engine.cpp:77
#12 0x00401fbf in SDL_main (argc=1, argv=0x321a08)
    at main.cpp:268
#13 0x004be4e8 in console_main ()
#14 0x00320000 in ?? ()
#15 0x00000000 in ?? ()
Compiling the library for debug, yields a better backtrace: (Win32ThreadSupport)

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 12724.0x1d0c]
0x0063e598 in Vectormath::Aos::loadXYZ (vec=..., fptr=0xa37d3f8)
    at C:/Users/Skeen/Desktop/bullet-2.77/src/vectormath/scalar/vec_aos.h:102
102         vec = Vector3( fptr[0], fptr[1], fptr[2] );

(gdb) backtrace
#0  0x0063e598 in Vectormath::Aos::loadXYZ (vec=..., fptr=0xa37d3f8)
    at C:/Users/Skeen/Desktop/bullet-2.77/src/vectormath/scalar/vec_aos.h:102
#1  0x00420076 in read_Vector3 (p=0xa37d3f8)
    at C:/Users/Skeen/Desktop/bullet-2.77/src/BulletMultiThreaded//TrbStateVec.h:30
#2  0x006a2c3e in TrbState::getAngularVelocity (this=0xa37d388)
    at C:/Users/Skeen/Desktop/bullet-2.77/src/BulletMultiThreaded//TrbStateVec.h:177
#3  0x00420f65 in btSetupContactConstraint (constraintResponse=..., constraintFriction1=..., constraintFriction2=..., penetrationDepth=-0.231498778, restitution=0, friction=0, contactNormal=..., contactPointA=..., contactPointB=..., stateA=..., stateB=..., solverBodyA=..., solverBodyB=..., separateBias=0.100000001, timeStep=0.0166666675)
    at C:\Users\Skeen\Desktop\bullet-2.77\src\BulletMultiThreaded\btParallelConstraintSolver.ccp:338
#4  0x00421556 in CustomSetupContactConstraintsTask (contactPairs=0x9bb74c0, numContactPairs=1, offsetRigStates=0x9bbd480, offsetSolverBodies=0x9bbcc50,  numRigidBodies=16, separateBias=0.100000001, timeStep=0.0166666675)
    at C:\Users\Skeen\Desktop\bullet-2.77\src\BulletMultiThreaded\btParallelConstraintSolver.ccp:447
#5  0x00421836 in SolverThreadFunc (userPtr=0x87d14f0, lsMemory=0x0)
    at C:\Users\Skeen\Desktop\bullet-2.77\src\BulletMultiThreaded\btParallelConstraintSolver.ccp:524
#6  0x00424310 in Thread_no_1 (lpParam=0x87d0188)
    at C:\Users\Skeen\Desktop\bullet-2.77\src\BulletMultiThreaded\Win32ThreadSupport.cpp:65
#7  0x77273677 in KERNEL32!BasepMapModuleHandle () from C:\Windows\syswow64\kernel32.dll
#8  0x087d0188 in ?? ()
#9  0x77b29d42 in ntdll!RtlpNtQueryValueKey () from C:\Windows\system32\ntdll.dll
#10 0x77b29d15 in ntdll!RtlpNtQueryValueKey () from C:\Windows\system32\ntdll.dll
#11 0x00000000 in ?? ()
I guess thats the backtrace you were looking for? :)
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

Erwin Coumans? :) - any idea? - or anyone else has an idea?
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

The dispatcher works as it should with multithreading, however the solver doesn't, switching the solver to SEQUENTIAL makes it work about 1/10 times. - Would I be better of with windows pthreads?
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

Same issue with the solver on pthreads.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: MultiThreaded Bullet Crashes

Post by Erwin Coumans »

It seems like the vectormath version is not correctly chosen because you are using an unsupported compiler/build system.

What compiler/build system are you using?
Thanks,
Erwin
skeen
Posts: 24
Joined: Wed Dec 08, 2010 11:59 am

Re: MultiThreaded Bullet Crashes

Post by skeen »

Erwin Coumans wrote: It seems like the vectormath version is not correctly chosen because you are using an unsupported compiler/build system.

What compiler/build system are you using?
Thanks,
Erwin
Hi Erwin.

I'm using g++, on Windows (MinGW), and can it really by that, the demo is working, thats whats bugging me.