dgFastRayTest::dgFastRayTest crash (another crash)

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Wed Dec 11, 2019 2:28 pm

ok I think I fix that. however here is a question.
That joint dgBallConstraint has all the limit and angel functionality disable for a while now.
why done you use the dCustomBallAndSocket.cpp forn teh joint library?

anyway if you sync, and you do no need limit I think is should work, I do not have a way to test it now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Thu Dec 12, 2019 4:56 am

I always find the weirdest bugs :)

Edit:

Ok, i will replace that with a custom joint as that is the last stock joint that i use.

I don't even need ball and socket limitations because i allow the bodies to collide and the collision handles limits - let me show a visualization:

Image

Notice that the truck and trailer are made of compound collision.
In contact callback i prevent the trailer-front and truck-rear from colliding by checking userdata on the shapes to identify which part is colliding, so the truck cabin and rest of trailer can collide and that makes the limit :)

You can enable this visuaization under F1 menu -> debugging tools -> "draw newton entities" and "draw newton materials" :)

Edit: I still have this question, i would like to make the trailer joint pull stronger - regardless of the trailer and truck mass: viewtopic.php?f=9&t=9220&p=65288
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Fri Dec 13, 2019 2:20 am

I got another crash to add :(

Code: Select all
Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: ..\..\dgPhysics\dgBody.cpp
Line: 753

Expression: contactJoint->m_isActive


This happened in contact callback - when calling NewtonContactJointRemoveContact, sadly i do not have a full stack trace because i was not running this from visual studio.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Fri Dec 13, 2019 5:46 am

Ok, another crash showed up, in dgCollisionCompound::dgNodeBase::BoxTest - this might be related to previous crash?

This time i had it in visual studio and have a whole call stack and variables:

Code: Select all
>   newton.dll!dgCollisionCompound::dgNodeBase::BoxTest(data={...}, otherNode=0x23b09d60) Line 296   C++
    newton.dll!dgCollisionCompound::CalculateContactsToCollisionTree(pair=0x23b0fb4c, proxy={...}) Line 2278   C++
    newton.dll!dgCollisionCompound::CalculateContacts(pair=0x23b0fb4c, proxy={...}) Line 1558   C++
    newton.dll!dgWorld::CompoundContacts(pair=0x23b0fb4c, proxy={...}) Line 1565   C++
    newton.dll!dgWorld::CalculateContacts(pair=0x23b0fb4c, threadIndex=2, ccdMode=false, intersectionTestOnly=false) Line 1646   C++
    newton.dll!dgBroadPhase::CalculatePairContacts(pair=0x23b0fb4c, threadID=2) Line 1082   C++
    newton.dll!dgBroadPhase::AddPair(contact=0x18990180, timestep=0.0166666675, threadIndex=2) Line 1131   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContacts(descriptor=0x178ffd84, timeStep=0.0166666675, threadID=2) Line 1557   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContactKernel(context=0x178ffd84, __formal=0x00000000, threadID=2) Line 1481   C++
    newton.dll!dgThreadHive::dgWorkerThread::RunNextJobInQueue(threadId=2) Line 224   C++
    newton.dll!dgThreadHive::dgWorkerThread::ConcurrentWork(threadId=2) Line 243   C++
    newton.dll!dgThreadHive::dgWorkerThread::Execute(threadId=2) Line 260   C++
    newton.dll!dgThread::dgThreadSystemCallback(threadData=0x189a1054) Line 201   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::_Do_call<,0>(_Myfargs={...}, __formal={...}) Line 1149   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::operator()<>() Line 1138   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Run(_Ln=0x01f5e770) Line 196   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Go() Line 187   C++
    newton.dll!_Call_func(_Data=0x01f5e770) Line 28   C++
    newton.dll!_callthreadstartex() Line 376   C
    newton.dll!_threadstartex(ptd=0x189b1a88) Line 359   C
    kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    ntdll.dll!__RtlUserThreadStart()   Unknown
    ntdll.dll!__RtlUserThreadStart@8()   Unknown


Image

locals:

Code: Select all
+      origin   {m_f=0x23b09980 {-107374176., -107374176., -107374176., -107374176.} m_i=0x23b09980 {-858993460, -858993460, ...} ...}   dgVector
+      p1   {m_f=0x23b09920 {-107374176., -107374176., -107374176., -107374176.} m_i=0x23b09920 {-858993460, -858993460, ...} ...}   dgVector
+      size   {m_f=0x23b09960 {-107374176., -107374176., -107374176., -107374176.} m_i=0x23b09960 {-858993460, -858993460, ...} ...}   dgVector
+      p0   {m_f=0x23b09940 {-107374176., -107374176., -107374176., -107374176.} m_i=0x23b09940 {-858993460, -858993460, ...} ...}   dgVector
+      this   0x18b89d00 {m_p0={m_f=0x18b89d00 {-0.312500000, -0.572916687, -0.187500000, 0.000000000} m_i=0x18b89d00 {...} ...} ...}   const dgCollisionCompound::dgNodeBase *
+      data   {m_matrix={m_front={m_f=0x23b09dd0 {0.971732855, -0.236082748, 0.000423877500, 0.000000000} m_i=0x23b09dd0 {...} ...} ...} ...}   const dgCollisionCompound::dgOOBBTestData &
+      otherNode   0x23b09d60 {m_p0={m_f=0x23b09d60 {86.9990005, -104.000999, 1.49899995, 0.000000000} m_i=0x23b09d60 {...} ...} ...}   const dgCollisionCompound::dgNodeBase * const
+      otherP1   {m_f=0x23b099a0 {9.23734760, 10.4672241, 1.86606753, 0.000000000} m_i=0x23b099a0 {1091816493, 1093106112, ...} ...}   dgVector
      separatingDistance   0.000000000   float
+      otherOrigin   {m_f=0x23b09a40 {3.91899490, 5.51486206, 0.855930686, 1.00000000} m_i=0x23b09a40 {1081790672, 1085307328, ...} ...}   dgVector
+      otherP0   {m_f=0x23b099e0 {-1.39935780, 0.562500000, -0.154206157, 0.000000000} m_i=0x23b099e0 {-1078780376, 1058013184, ...} ...}   dgVector
+      otherSize   {m_f=0x23b09a20 {5.31835270, 4.95236206, 1.01013684, 0.000000000} m_i=0x23b09a20 {1084895218, 1084127680, ...} ...}   dgVector
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Fri Dec 13, 2019 3:23 pm

that look like an explosion, let us solve the problem with the joint and them you can make a repro.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Tue Dec 17, 2019 5:34 pm

I finally got the other crash - for dgAssert(contactJoint->m_isActive) - it seems to be related to other bugs and is a real issue.

It seems like the contact callback is called - which my code uses discard some contacts based on shapes of compound collision - and when NewtonContactJointRemoveContact is called calls world->GlobalUnlock and that calls dgBody::SetSleepState - and that finds out that the contact joint is not active and crashes with assert.

I am not sure if this is in my opinion a bug in contact iteration ( NewtonContactJointGetFirstContact + NewtonContactJointGetNextContact ) - that those have provided a contact callback for a body that is no longer active, or that this is a setsleepstate which checks all contacts if they are active improperly?

This is call stack:

Code: Select all
>   newton.dll!dgBody::SetSleepState(state=false) Line 753   C++
    newton.dll!NewtonContactJointRemoveContact(contactJoint=0x0d769f40, contact=0x184f14e0) Line 5489   C++
    TDC.exe!CARHITCAR()   C++
    newton.dll!dgWorld::PopulateContacts(pair, threadIndex) Line 1502   C++
    newton.dll!dgWorld::ProcessContacts(pair, threadIndex) Line 1532   C++
    newton.dll!dgBroadPhase::CalculatePairContacts(pair, threadID) Line 1085   C++
    newton.dll!dgBroadPhase::AddPair(contact=0x0d769f40, timestep=0.0166666675, threadIndex=1) Line 1131   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContacts(descriptor, timeStep, threadID) Line 1557   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContactKernel(context=0x178cfd84, __formal=0x00000000, threadID=1) Line 1481   C++
    newton.dll!dgThreadHive::dgWorkerThread::RunNextJobInQueue(threadId=1) Line 224   C++
    newton.dll!dgThreadHive::dgWorkerThread::ConcurrentWork(threadId=1) Line 243   C++
    newton.dll!dgThreadHive::dgWorkerThread::Execute(threadId=1) Line 260   C++
    newton.dll!dgThread::dgThreadSystemCallback(threadData=0x18b9127c) Line 201   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::_Do_call<,0>(_Myfargs={...}, __formal={...}) Line 1149   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::operator()<>() Line 1138   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Run(_Ln=0x01f5e770) Line 196   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Go() Line 187   C++
    newton.dll!_Call_func(_Data=0x01f5e770) Line 28   C++
    newton.dll!_callthreadstartex() Line 376   C
    newton.dll!_threadstartex(ptd=0x18b9d5e0) Line 359   C
    kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    ntdll.dll!__RtlUserThreadStart()   Unknown
    ntdll.dll!__RtlUserThreadStart@8()   Unknown



local variables:

Code: Select all
-      contactJoint   0x18b835c0 {m_positAcc={m_f=0x18b83610 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b83610 {...} ...} ...}   dgContact * const
+      dgConstraint   {m_userData=0x00000000 m_body0=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, ...} ...} ...} ...}   dgConstraint
+      dgList<dgContactMaterial>   {m_count=4 m_first=0x18c9fbe0 {m_info={m_dir0={m_f=0x18c9fc40 {...} m_i=0x18c9fc40 {...} m_type={...} ...} ...} ...} ...}   dgList<dgContactMaterial>
+      m_positAcc   {m_f=0x18b83610 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b83610 {0, 0, 0, 0} m_type=...}   dgVector
+      m_rotationAcc   {m_x=0.000000000 m_y=0.000000000 m_z=0.000000000 ...}   dgQuaternion
+      m_separtingVector   {m_f=0x18b83630 {-0.0700577274, -0.997542858, -4.16682233e-005, 0.000000000} m_i=0x18b83630 {-1114670483, ...} ...}   dgVector
+      m_material   0x18b7d320 {m_dir0={m_f=0x18b7d370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b7d370 {...} ...} ...}   const dgContactMaterial *
      m_closestDistance   0.000000000   float
      m_separationDistance   0.000000000   float
      m_timeOfImpact   1.00000000e+010   float
      m_impulseSpeed   0.000000000   float
      m_contactPruningTolereance   0.0500000007   float
      m_broadphaseLru   24017   unsigned int
      m_killContact   0   unsigned int
      m_isNewContact   0   unsigned int
      m_skeletonIntraCollision   1   unsigned int
      m_skeletonSelftCollision   1   unsigned int
-      contact   0x18b835c0 {m_positAcc={m_f=0x18b83610 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b83610 {...} ...} ...}   dgConstraint *
+      [dgContact]   {m_positAcc={m_f=0x18b83610 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b83610 {0, ...} ...} ...}   dgContact
+      __vfptr   0x6864b5ac {newton.dll!const dgContact::`vftable'{for `dgConstraint'}} {0x68436da0 {newton.dll!dgContact::ResetMaxDOF(void)}, ...}   void * *
      m_userData   0x00000000   void *
+      m_body0   0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=...} ...}   dgBody *
+      m_body1   0x18b89180 {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=...} ...}   dgBody *
+      m_link0   0x25d96560 {m_info={m_joint=0x18b835c0 {m_positAcc={m_f=0x18b83610 {...} m_i=0x18b83610 {...} m_type=...} ...} ...} ...}   dgList<dgBodyMasterListCell>::dgListNode *
+      m_link1   0x25d95f20 {m_info={m_joint=0x18b835c0 {m_positAcc={m_f=0x18b83610 {...} m_i=0x18b83610 {...} m_type=...} ...} ...} ...}   dgList<dgBodyMasterListCell>::dgListNode *
      m_updaFeedbackCallback   0x00000000   void (const dgConstraint &, float, int) *
      m_clusterLRU   -1   int
      m_index   2   unsigned int
      m_impulseLru   0   unsigned int
      m_dynamicsLru   0   unsigned int
      m_maxDOF   12   unsigned int
      m_constId   3   unsigned int
      m_solverModel   2   unsigned int
      m_enableCollision   1   unsigned int
      m_isActive   1   unsigned int
      m_isBilateral   0   unsigned int
      m_graphTagged   1   unsigned int
      m_isInSkeleton   0   unsigned int
      m_isInSkeletonLoop   0   unsigned int
-      this   0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=...} ...}   dgBody *
+      [dgDynamicBody]   {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=0x18662070 {...} ...} ...}   dgDynamicBody
+      __vfptr   0x686547b4 {newton.dll!const dgDynamicBody::`vftable'} {0x68449a70 {newton.dll!dgDynamicBody::`scalar deleting destructor'(unsigned int)}, ...}   void * *
+      m_matrix   {m_front={m_f=0x18661e90 {-0.997542858, 0.0700577274, 0.000155081143, 0.000000000} m_i=0x18661e90 {-1082171656, ...} ...} ...}   dgMatrix
+      m_rotation   {m_x=7.67626843e-005 m_y=-2.35391381e-005 m_z=0.999385536 ...}   dgQuaternion
+      m_invWorldInertiaMatrix   {m_front={m_f=0x18661ee0 {0.0101991091, 0.00283021224, -4.74074113e-010, 0.000000000} m_i=0x18661ee0 {...} ...} ...}   dgMatrix
+      m_mass   {m_f=0x18661f20 {99.8398209, 18.5340500, 107.957207, 1000.00000} m_i=0x18661f20 {1120382461, 1100236220, ...} ...}   dgVector
+      m_invMass   {m_f=0x18661f30 {0.0100160437, 0.0539547466, 0.00926292967, 0.00100000005} m_i=0x18661f30 {1008998997, ...} ...}   dgVector
+      m_veloc   {m_f=0x18661f40 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f40 {0, 0, 0, 0} m_type=...}   dgVector
+      m_omega   {m_f=0x18661f50 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f50 {0, 0, 0, 0} m_type=...}   dgVector
+      m_accel   {m_f=0x18661f60 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f60 {0, 0, 0, 0} m_type=...}   dgVector
+      m_alpha   {m_f=0x18661f70 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f70 {0, 0, 0, 0} m_type=...}   dgVector
+      m_minAABB   {m_f=0x18661f80 {117.174011, -100.830193, 1.43983102, 0.000000000} m_i=0x18661f80 {1122654488, -1026971377, ...} ...}   dgVector
+      m_maxAABB   {m_f=0x18661f90 {117.774902, -99.6082382, 1.82049358, 0.000000000} m_i=0x18661f90 {1122733248, -1027131541, ...} ...}   dgVector
+      m_localCentreOfMass   {m_f=0x18661fa0 {-6.34672759e-010, 0.00181030203, 1.13334420e-009, 1.00000000} m_i=0x18661fa0 {-1339132640, ...} ...}   dgVector
+      m_globalCentreOfMass   {m_f=0x18661fb0 {117.474327, -100.221024, 1.63293993, 1.00000000} m_i=0x18661fb0 {1122693851, -1027051222, ...} ...}   dgVector
+      m_impulseForce   {m_f=0x18661fc0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fc0 {0, 0, 0, 0} m_type=...}   dgVector
+      m_impulseTorque   {m_f=0x18661fd0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fd0 {0, 0, 0, 0} m_type=...}   dgVector
+      m_gyroAlpha   {m_f=0x18661fe0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fe0 {0, 0, 0, 0} m_type=...}   dgVector
+      m_gyroTorque   {m_f=0x18661ff0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661ff0 {0, 0, 0, 0} m_type=...}   dgVector
+      m_gyroRotation   {m_x=7.67626843e-005 m_y=-2.35391381e-005 m_z=0.999385536 ...}   dgQuaternion
      m_criticalSectionLock   0   int
      m_flags   3688   unsigned int
      m_freeze   0   unsigned int
      m_resting   0   unsigned int
      m_sleeping   0   unsigned int
      m_autoSleep   1   unsigned int
      m_inCallback   0   unsigned int
      m_jointSet   1   unsigned int
      m_collidable   1   unsigned int
      m_equilibrium   0   unsigned int
      m_spawnnedFromCallback   0   unsigned int
      m_continueCollisionMode   1   unsigned int
      m_collideWithLinkedBodies   1   unsigned int
      m_transformIsDirty   1   unsigned int
      m_gyroTorqueOn   0   unsigned int
      m_isdead   0   unsigned int
      m_userData   0x1b7e2124   void *
+      m_world   0x18af5460 {m_destructor=0x00000000 }   dgWorld *
+      m_collision   0x25defea0 {m_globalMatrix={m_front={m_f=0x25defea0 {-0.997542858, 0.0700577274, 0.000155081143, 0.000000000} ...} ...} ...}   dgCollisionInstance *
+      m_broadPhaseNode   0x18d81380 {m_body=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, ...} ...} ...} ...}   dgBroadPhaseBodyNode *
+      m_masterNode   0x18b8d580 {m_info={m_body=0x18661e80 {m_externalForce={m_f=0x18662070 {...} m_i=0x18662070 {...} m_type=...} ...} } ...}   dgList<dgBodyMasterListRow>::dgListNode *
+      m_broadPhaseaggregateNode   0x00000000 <NULL>   dgBroadPhaseAggregate *
      m_destructor   0x00000000   void (dgBody &) *
      m_matrixUpdate   0x004559a0 {TDC.exe!CARTRANSFORM(void)}   void (const dgBody &, const dgMatrix &, int) *
+      m_disjointInfo   {m_parent=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} ...} ...} ...}   dgBody::dgSetInfo
      m_index   -1   int
      m_uniqueID   6151   int
      m_bodyGroupId   1   int
      m_rtti   3   int
      m_type   0   int
      m_serializedEnum   -1   int
      m_dynamicsLru   0   unsigned int
      m_genericLRUMark   0   unsigned int
      state   false   bool



image: https://i.imgur.com/PL4j526.png

Image
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Tue Dec 17, 2019 7:13 pm

Ok I will look to that, I see that

newton.dll!dgBody::SetSleepState(state=false) Line 753 C++
newton.dll!NewtonContactJointRemoveContact(contactJoint=0x0d769f40, contact=0x184f14e0) Line 5489 C++
TDC.exe!CARHITCAR() C++

you destroy that contact as soon as it was created,the the Sleep check, has problem, I believe that should no be a problem, unless oen of the bodies was dead, by teh function add contact will no let that happens, again unless the callback also killed one of the bodies

what I do not understand is how that code that come from the solve relate to this
I am not sure if this is in my opinion a bug in contact iteration ( NewtonContactJointGetFirstContact + NewtonContactJointGetNextContact ) - that those have provided a contact callback for a body that is no longer active, or that this is a setsleepstate which checks all contacts if they are active improperly?


you are right those funtion soue check for dead bodies or contacts.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Wed Dec 18, 2019 2:05 am

That contact callback does not delete bodies, all body deletion happens outside the callbacks, it just removes contacts it doesn't want to collide.

I still have debugger open on this crash and can look things up, so this is contactjoint->dgconstraint:

- dgConstraint {m_userData=0x00000000 m_body0=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, ...} ...} ...} ...} dgConstraint
+ __vfptr 0x6864b5ac {newton.dll!const dgContact::`vftable'{for `dgConstraint'}} {0x68436da0 {newton.dll!dgContact::ResetMaxDOF(void)}, ...} void * *
m_userData 0x00000000 void *
+ m_body0 0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=...} ...} dgBody *
+ m_body1 0x18b89180 {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=...} ...} dgBody *
+ m_link0 0x25d96560 {m_info={m_joint=0x18b835c0 {m_positAcc={m_f=0x18b83610 {...} m_i=0x18b83610 {...} m_type=...} ...} ...} ...} dgList<dgBodyMasterListCell>::dgListNode *
+ m_link1 0x25d95f20 {m_info={m_joint=0x18b835c0 {m_positAcc={m_f=0x18b83610 {...} m_i=0x18b83610 {...} m_type=...} ...} ...} ...} dgList<dgBodyMasterListCell>::dgListNode *
m_updaFeedbackCallback 0x00000000 void (const dgConstraint &, float, int) *
m_clusterLRU -1 int
m_index 2 unsigned int
m_impulseLru 0 unsigned int
m_dynamicsLru 0 unsigned int
m_maxDOF 12 unsigned int
m_constId 3 unsigned int
m_solverModel 2 unsigned int
m_enableCollision 1 unsigned int
m_isActive 1 unsigned int
m_isBilateral 0 unsigned int
m_graphTagged 1 unsigned int
m_isInSkeleton 0 unsigned int
m_isInSkeletonLoop 0 unsigned int



contactjoint does not have "newcontact" flag on it:

Image

m_body0:

- m_body0 0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=...} ...} dgBody *
+ [dgDynamicBody] {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} m_i=0x18662070 {...} ...} ...} dgDynamicBody
+ __vfptr 0x686547b4 {newton.dll!const dgDynamicBody::`vftable'} {0x68449a70 {newton.dll!dgDynamicBody::`scalar deleting destructor'(unsigned int)}, ...} void * *
+ m_matrix {m_front={m_f=0x18661e90 {-0.997542858, 0.0700577274, 0.000155081143, 0.000000000} m_i=0x18661e90 {-1082171656, ...} ...} ...} dgMatrix
+ m_rotation {m_x=7.67626843e-005 m_y=-2.35391381e-005 m_z=0.999385536 ...} dgQuaternion
+ m_invWorldInertiaMatrix {m_front={m_f=0x18661ee0 {0.0101991091, 0.00283021224, -4.74074113e-010, 0.000000000} m_i=0x18661ee0 {...} ...} ...} dgMatrix
+ m_mass {m_f=0x18661f20 {99.8398209, 18.5340500, 107.957207, 1000.00000} m_i=0x18661f20 {1120382461, 1100236220, ...} ...} dgVector
+ m_invMass {m_f=0x18661f30 {0.0100160437, 0.0539547466, 0.00926292967, 0.00100000005} m_i=0x18661f30 {1008998997, ...} ...} dgVector
+ m_veloc {m_f=0x18661f40 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f40 {0, 0, 0, 0} m_type=...} dgVector
+ m_omega {m_f=0x18661f50 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f50 {0, 0, 0, 0} m_type=...} dgVector
+ m_accel {m_f=0x18661f60 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f60 {0, 0, 0, 0} m_type=...} dgVector
+ m_alpha {m_f=0x18661f70 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661f70 {0, 0, 0, 0} m_type=...} dgVector
+ m_minAABB {m_f=0x18661f80 {117.174011, -100.830193, 1.43983102, 0.000000000} m_i=0x18661f80 {1122654488, -1026971377, ...} ...} dgVector
+ m_maxAABB {m_f=0x18661f90 {117.774902, -99.6082382, 1.82049358, 0.000000000} m_i=0x18661f90 {1122733248, -1027131541, ...} ...} dgVector
+ m_localCentreOfMass {m_f=0x18661fa0 {-6.34672759e-010, 0.00181030203, 1.13334420e-009, 1.00000000} m_i=0x18661fa0 {-1339132640, ...} ...} dgVector
+ m_globalCentreOfMass {m_f=0x18661fb0 {117.474327, -100.221024, 1.63293993, 1.00000000} m_i=0x18661fb0 {1122693851, -1027051222, ...} ...} dgVector
+ m_impulseForce {m_f=0x18661fc0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fc0 {0, 0, 0, 0} m_type=...} dgVector
+ m_impulseTorque {m_f=0x18661fd0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fd0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroAlpha {m_f=0x18661fe0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661fe0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroTorque {m_f=0x18661ff0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18661ff0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroRotation {m_x=7.67626843e-005 m_y=-2.35391381e-005 m_z=0.999385536 ...} dgQuaternion
m_criticalSectionLock 0 int
m_flags 3688 unsigned int
m_freeze 0 unsigned int
m_resting 0 unsigned int
m_sleeping 0 unsigned int
m_autoSleep 1 unsigned int
m_inCallback 0 unsigned int
m_jointSet 1 unsigned int
m_collidable 1 unsigned int
m_equilibrium 0 unsigned int
m_spawnnedFromCallback 0 unsigned int
m_continueCollisionMode 1 unsigned int
m_collideWithLinkedBodies 1 unsigned int
m_transformIsDirty 1 unsigned int
m_gyroTorqueOn 0 unsigned int
m_isdead 0 unsigned int
m_userData 0x1b7e2124 void *
+ m_world 0x18af5460 {m_destructor=0x00000000 } dgWorld *
+ m_collision 0x25defea0 {m_globalMatrix={m_front={m_f=0x25defea0 {-0.997542858, 0.0700577274, 0.000155081143, 0.000000000} ...} ...} ...} dgCollisionInstance *
+ m_broadPhaseNode 0x18d81380 {m_body=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, ...} ...} ...} ...} dgBroadPhaseBodyNode *
+ m_masterNode 0x18b8d580 {m_info={m_body=0x18661e80 {m_externalForce={m_f=0x18662070 {...} m_i=0x18662070 {...} m_type=...} ...} } ...} dgList<dgBodyMasterListRow>::dgListNode *
+ m_broadPhaseaggregateNode 0x00000000 <NULL> dgBroadPhaseAggregate *
m_destructor 0x00000000 void (dgBody &) *
m_matrixUpdate 0x004559a0 {TDC.exe!CARTRANSFORM(void)} void (const dgBody &, const dgMatrix &, int) *
+ m_disjointInfo {m_parent=0x18661e80 {m_externalForce={m_f=0x18662070 {0.000000000, 0.000000000, -20000.0000, 0.000000000} ...} ...} ...} dgBody::dgSetInfo
m_index -1 int
m_uniqueID 6151 int
m_bodyGroupId 1 int
m_rtti 3 int
m_type 0 int
m_serializedEnum -1 int
m_dynamicsLru 0 unsigned int
m_genericLRUMark 0 unsigned int



m_body1:

- m_body1 0x18b89180 {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=...} ...} dgBody *
+ [dgDynamicBody] {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89370 {...} ...} ...} dgDynamicBody
+ __vfptr 0x686547b4 {newton.dll!const dgDynamicBody::`vftable'} {0x68449a70 {newton.dll!dgDynamicBody::`scalar deleting destructor'(unsigned int)}, ...} void * *
+ m_matrix {m_front={m_f=0x18b89190 {1.00000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89190 {1065353216, ...} ...} ...} dgMatrix
+ m_rotation {m_x=0.000000000 m_y=0.000000000 m_z=0.000000000 ...} dgQuaternion
+ m_invWorldInertiaMatrix {m_front={m_f=0x18b891e0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b891e0 {0, 0, ...} ...} ...} dgMatrix
+ m_mass {m_f=0x18b89220 {9.99999987e+014, 9.99999987e+014, 9.99999987e+014, 9.99999987e+014} m_i=0x18b89220 {...} ...} dgVector
+ m_invMass {m_f=0x18b89230 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89230 {0, 0, 0, 0} m_type=...} dgVector
+ m_veloc {m_f=0x18b89240 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89240 {0, 0, 0, 0} m_type=...} dgVector
+ m_omega {m_f=0x18b89250 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89250 {0, 0, 0, 0} m_type=...} dgVector
+ m_accel {m_f=0x18b89260 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89260 {0, 0, 0, 0} m_type=...} dgVector
+ m_alpha {m_f=0x18b89270 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b89270 {0, 0, 0, 0} m_type=...} dgVector
+ m_minAABB {m_f=0x18b89280 {63.9365005, -128.063507, 0.936500072, 0.000000000} m_i=0x18b89280 {1115668218, -1023406014, ...} ...} dgVector
+ m_maxAABB {m_f=0x18b89290 {128.063507, -63.9364967, 4.06349993, 0.000000000} m_i=0x18b89290 {1124077634, -1031815431, ...} ...} dgVector
+ m_localCentreOfMass {m_f=0x18b892a0 {0.000000000, 0.000000000, 0.000000000, 1.00000000} m_i=0x18b892a0 {0, 0, 0, 1065353216} ...} dgVector
+ m_globalCentreOfMass {m_f=0x18b892b0 {32.0000000, 32.0000000, 0.000000000, 1.00000000} m_i=0x18b892b0 {1107296256, 1107296256, ...} ...} dgVector
+ m_impulseForce {m_f=0x18b892c0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b892c0 {0, 0, 0, 0} m_type=...} dgVector
+ m_impulseTorque {m_f=0x18b892d0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b892d0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroAlpha {m_f=0x18b892e0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b892e0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroTorque {m_f=0x18b892f0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x18b892f0 {0, 0, 0, 0} m_type=...} dgVector
+ m_gyroRotation {m_x=0.000000000 m_y=0.000000000 m_z=0.000000000 ...} dgQuaternion
m_criticalSectionLock 0 int
m_flags 1262 unsigned int
m_freeze 0 unsigned int
m_resting 1 unsigned int
m_sleeping 1 unsigned int
m_autoSleep 1 unsigned int
m_inCallback 0 unsigned int
m_jointSet 1 unsigned int
m_collidable 1 unsigned int
m_equilibrium 1 unsigned int
m_spawnnedFromCallback 0 unsigned int
m_continueCollisionMode 0 unsigned int
m_collideWithLinkedBodies 1 unsigned int
m_transformIsDirty 0 unsigned int
m_gyroTorqueOn 0 unsigned int
m_isdead 0 unsigned int
m_userData 0x06a39094 void *
+ m_world 0x18af5460 {m_destructor=0x00000000 } dgWorld *
+ m_collision 0x18b84f00 {m_globalMatrix={m_front={m_f=0x18b84f00 {1.00000000, 0.000000000, 0.000000000, 0.000000000} ...} ...} ...} dgCollisionInstance *
+ m_broadPhaseNode 0x18bda260 {m_body=0x18b89180 {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, ...} ...} ...} ...} dgBroadPhaseBodyNode *
+ m_masterNode 0x18b8c440 {m_info={m_body=0x18b89180 {m_externalForce={m_f=0x18b89370 {...} m_i=0x18b89370 {...} m_type=...} ...} } ...} dgList<dgBodyMasterListRow>::dgListNode *
+ m_broadPhaseaggregateNode 0x00000000 <NULL> dgBroadPhaseAggregate *
m_destructor 0x00000000 void (dgBody &) *
m_matrixUpdate 0x00000000 void (const dgBody &, const dgMatrix &, int) *
+ m_disjointInfo {m_parent=0x18b89180 {m_externalForce={m_f=0x18b89370 {0.000000000, 0.000000000, 0.000000000, 0.000000000} ...} ...} ...} dgBody::dgSetInfo
m_index -1 int
m_uniqueID 7 int
m_bodyGroupId 5 int
m_rtti 3 int
m_type 0 int
m_serializedEnum -1 int
m_dynamicsLru 0 unsigned int
m_genericLRUMark 0 unsigned int



Bodh bodies have m_isdead = 0 so they were not destroyed?

I will keep this debug session open and can lookup anything that you might need :)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Wed Dec 18, 2019 10:59 am

Yes but let get the other problem fix first.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Fri Dec 20, 2019 7:39 am

Ok, the other issue is good now, the joint mass call works great:

viewtopic.php?f=9&t=9220&p=65324#p65324

I still have this crash debug session live in visual studio, so i can still check if you need any info regarding this crash because this crash is difficult to reproduce - i'm not totally sure of conditions how to trigger it reliably.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Fri Dec 20, 2019 10:02 am

All right, is this reproducible?

Can you put together a repro with the fixes,so that we deal with this now.
Before that get later, I did find a bug with cc'd and static meshes where the distance between the two shapes can become zero after they are measured the first time.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Fri Dec 20, 2019 4:27 pm

It is not clear how it is reproduced, i had it happen about 5 times and only this time i have visual studio open to debug it. Usually it happens randomly if i leave game running for a very long time.

It seems to happen only sometimes and always when jointremovecontact is called, that calls the sleepstate function and an assert is triggered there.

I will build a new demo with the rest of fixes, but i still have visual studio opened at the assert, so if you have a idea what i could look, i can still check in debugger.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Fri Dec 20, 2019 4:54 pm

Can you list the trace stack when it happens again?
I just wanted to make sure you test it with the last commit.

I may be able to check it logically.
The last listing you made seem like a log and are hard to follow.

The part I am looking at is the assert in function SetSleepState, that is call when you call Remove contact.
The assert is a good thing, but I think the function is called after the contact is already removed, which made the contact inactive untill the contact garbage collector delete it.
I need to change the order of the calls, but I first has to check for side effects.

I will make that change and them we test again
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Sat Dec 21, 2019 6:16 am

Okay, i will work on reproducing if it happens again.

Just to simplify things -

CARHITCAR is contact callback, so flow to crash was this:

CARHITCAR Contact callback for car material ->
NewtonContactJointRemoveContact ->
world->GlobalUnlock(); ->
void dgBody::SetSleepState(bool state) ->
dgAssert(contactJoint->m_isActive);

Code: Select all
>   newton.dll!dgBody::SetSleepState(state=false) Line 753   C++
    newton.dll!NewtonContactJointRemoveContact(contactJoint=0x0d769f40, contact=0x184f14e0) Line 5489   C++
    TDC.exe!CARHITCAR()   C++
    newton.dll!dgWorld::PopulateContacts(pair, threadIndex) Line 1502   C++
    newton.dll!dgWorld::ProcessContacts(pair, threadIndex) Line 1532   C++
    newton.dll!dgBroadPhase::CalculatePairContacts(pair, threadID) Line 1085   C++
    newton.dll!dgBroadPhase::AddPair(contact=0x0d769f40, timestep=0.0166666675, threadIndex=1) Line 1131   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContacts(descriptor, timeStep, threadID) Line 1557   C++
    newton.dll!dgBroadPhase::UpdateRigidBodyContactKernel(context=0x178cfd84, __formal=0x00000000, threadID=1) Line 1481   C++
    newton.dll!dgThreadHive::dgWorkerThread::RunNextJobInQueue(threadId=1) Line 224   C++
    newton.dll!dgThreadHive::dgWorkerThread::ConcurrentWork(threadId=1) Line 243   C++
    newton.dll!dgThreadHive::dgWorkerThread::Execute(threadId=1) Line 260   C++
    newton.dll!dgThread::dgThreadSystemCallback(threadData=0x18b9127c) Line 201   C++
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Sat Dec 21, 2019 12:12 pm

afte looking at it is seem the solution is to remove assert
dgAssert(contactJoint->m_isActive);

it is possibly to call of a joint that was declare dead because is on the list.
there was a function that check if a joint was active but I removed because is was complex,
but in fact ther is not harm in operation on an inactive joint for a call back.
this is totally legal because joint can become active and inaction all the time.

I just remove that line please sync and try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 12 guests