dgFastRayTest::dgFastRayTest crash (another crash)

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

dgFastRayTest::dgFastRayTest crash (another crash)

Postby JernejL » Tue Dec 03, 2019 9:46 am

This is a second type of assert / crash that is happening since latest updates, i saw this before but it was suepr rare to trigger it.

Code: Select all
Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: j:\appbuilder\delfi\top down city\code\tparty\newtonproject\newton-dynamics\sdk\dgcore\dgIntersections.h
Line: 137

Expression: m_diff.DotProduct(m_diff).GetScalar() > dgFloat32 (0.0f)


Call stack:

Code: Select all
>   newton.dll!dgFastRayTest::dgFastRayTest(l0={...}, l1={...}) Line 137   C++
    newton.dll!dgCollisionCompound::CalculateContactsToCollisionTreeContinue(pair=0x2395f9c8, proxy={...}) Line 2816   C++
    newton.dll!dgCollisionCompound::CalculateContacts(pair=0x2395f9c8, proxy={...}) Line 1542   C++
    newton.dll!dgWorld::CompoundContacts(pair=0x2395f9c8, proxy={...}) Line 1565   C++
    newton.dll!dgWorld::CalculateTimeToImpact(contact=0x18a0f4c0, timestep=0.0166666675, threadIndex=2, p={...}, q={...}, normal={...}, dist=-0.00390625000) Line 1694   C++
    newton.dll!dgWorldDynamicUpdate::ResolveClusterForces(cluster=0x189cc0d4, threadID=2, timestep=0.0166666675) Line 814   C++
    newton.dll!dgWorldDynamicUpdate::CalculateClusterReactionForcesKernel(context=0x1793fd9c, worldContext=0x189827e0, threadID=2) Line 458   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=0x18a1f614) 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=0x01f4e774) 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=0x01f4e774) Line 28   C++
    newton.dll!_callthreadstartex() Line 376   C
    newton.dll!_threadstartex(ptd=0x18a305d8) Line 359   C
    kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    ntdll.dll!__RtlUserThreadStart()   Unknown
    ntdll.dll!__RtlUserThreadStart@8()   Unknown


Local variables:

Code: Select all
-      this   0x2395c3f0 {m_p0={m_f=0x2395c3f0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c3f0 {...} ...} ...}   dgFastRayTest *
+      m_p0   {m_f=0x2395c3f0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c3f0 {0, 0, 0, 0} m_type=...}   dgVector
+      m_p1   {m_f=0x2395c400 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c400 {0, 0, 0, 0} m_type=...}   dgVector
+      m_diff   {m_f=0x2395c410 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c410 {0, 0, 0, 0} m_type=...}   dgVector
+      m_dpInv   {m_f=0x2395c420 {-107374176., -107374176., -107374176., -107374176.} m_i=0x2395c420 {-858993460, -858993460, ...} ...}   dgVector
+      m_minT   {m_f=0x2395c430 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c430 {0, 0, 0, 0} m_type=...}   dgVector
+      m_maxT   {m_f=0x2395c440 {1.00000000, 1.00000000, 1.00000000, 1.00000000} m_i=0x2395c440 {1065353216, 1065353216, ...} ...}   dgVector
+      m_unitDir   {m_f=0x2395c450 {-107374176., -107374176., -107374176., -107374176.} m_i=0x2395c450 {-858993460, -858993460, ...} ...}   dgVector
+      m_isParallel   {m_f=0x2395c460 {-107374176., -107374176., -107374176., -107374176.} m_i=0x2395c460 {-858993460, -858993460, ...} ...}   dgVector
-      l0   {m_f=0x2395c480 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c480 {0, 0, 0, 0} m_type=...}   const dgVector &
+      m_f   0x2395c480 {0.000000000, 0.000000000, 0.000000000, 0.000000000}   float[4]
+      m_i   0x2395c480 {0, 0, 0, 0}   int[4]
+      m_type   {m128_f32=0x2395c480 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m128_u64=0x2395c480 {0, 0} ...}   __m128
+      m_typeInt   {m128i_i8=0x2395c480 "" m128i_i16=0x2395c480 {0, 0, 0, 0, 0, 0, 0, 0} m128i_i32=0x2395c480 {0, 0, 0, ...} ...}   __m128i
      m_x   0.000000000   float
      m_y   0.000000000   float
      m_z   0.000000000   float
      m_w   0.000000000   float
      m_ix   0   int
      m_iy   0   int
      m_iz   0   int
      m_iw   0   int
-      l1   {m_f=0x2395c4a0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m_i=0x2395c4a0 {0, 0, 0, 0} m_type=...}   const dgVector &
+      m_f   0x2395c4a0 {0.000000000, 0.000000000, 0.000000000, 0.000000000}   float[4]
+      m_i   0x2395c4a0 {0, 0, 0, 0}   int[4]
+      m_type   {m128_f32=0x2395c4a0 {0.000000000, 0.000000000, 0.000000000, 0.000000000} m128_u64=0x2395c4a0 {0, 0} ...}   __m128
+      m_typeInt   {m128i_i8=0x2395c4a0 "" m128i_i16=0x2395c4a0 {0, 0, 0, 0, 0, 0, 0, 0} m128i_i32=0x2395c4a0 {0, 0, 0, ...} ...}   __m128i
      m_x   0.000000000   float
      m_y   0.000000000   float
      m_z   0.000000000   float
      m_w   0.000000000   float
      m_ix   0   int
      m_iy   0   int
      m_iz   0   int
      m_iw   0   int



What could i do to solve this? it seems related to compound collisions.
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 03, 2019 3:04 pm

oh there maybe be CCD cause this. let us deal with the other bug first. something is exploding and we need to find out the cause.
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 04, 2019 2:09 am

I also triggered this assert now, i will pull code, build it and report on status of the other crash in dgVector::Floor():

Code: Select all
File: j:\appbuilder\delfi\top down city\code\tparty\newtonproject\newton-dynamics\sdk\dgcore\dgIntersections.h
Line: 137

Expression: m_diff.DotProduct(m_diff).GetScalar() > dgFloat32 (0.0f)

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 » Wed Dec 04, 2019 4:04 am

Ok, here is the result with the new test:

Code: Select all
warning bodies 87 v(-4.804775 -190.029358 24.683014) w(22.459690 2.192234 12.174899) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(-4.804780 -190.029358 24.683006) w(8.948650 0.873455 -0.666667) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(-4.804773 -190.029327 24.683006) w(8.932911 0.871919 -2.333334) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(-4.804784 -190.029312 24.682997) w(8.669266 0.846185 -4.000000) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(-4.804782 -190.029343 24.683002) w(8.140156 0.794540 -5.666667) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(1.438028 -140.634430 36.489182) w(6.503468 0.096296 1.255205) with very high velocity or angular velocity, may be unstable
warning bodies 87 v(5.013581 -117.005180 43.297977) w(6.228528 -0.224061 2.036309) with very high velocity or angular velocity, may be unstable


Code: Select all
Debug Assertion Failed!

Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: j:\appbuilder\delfi\top down city\code\tparty\newtonproject\newton-dynamics\sdk\dgcore\dgIntersections.h
Line: 137

Expression: m_diff.DotProduct(m_diff).GetScalar() > dgFloat32 (0.0f)


I think i know what this is related to - and i happen to have a video of it, because it is one of bugs i did not yet report (there were 3 crashes reported so i wanted to wait for those to be solved first)

This crash happens in proximity of this large heavy truck that has started to vibrate on ground in this version.
The truck is a convex hull with mass of 9000.0

It's mass center is in body center - 0, 0, 0, mass matrix is also calculated correctly.

Code: Select all
   NewtonBodySetCentreOfMass(Newton_CarBody, @massC.x);

   // set the body mass and inertia

   mass_inertia.set_values(mass * (dimensions.y * dimensions.y + dimensions.z * dimensions.z) / 12.0,
                      mass * (dimensions.x * dimensions.x + dimensions.z * dimensions.z) / 12.0,
                     mass * (dimensions.x * dimensions.x + dimensions.y * dimensions.y) / 12.0);

   newtonBodySetMassMatrix(Newton_CarBody, mass, mass_inertia.x, mass_inertia.y, mass_inertia.z);



This vibration on the truck did not occur before i updated newton, previous stable build i used was from june 2019.

Video:
https://www.youtube.com/watch?v=OLF-hdaNh3Y

I can make you a demo where the truck will spawn near player, and also show body ID - NewtonBodyGetID
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 04, 2019 8:22 am

Ah ok, make the repro, with the vehicle closed to the player and the label.

How you do the vehicle, is there a joint that drive it?
The bug may be there.
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 04, 2019 4:29 pm

I have made a new test:

https://gtamp.com/tdc/tdc_demo_error.7z

just enter the truck you will spawn at and drive it into the yellow bulldozer, the collision is guaranteed to trigger a crash, you can just drive straight - it will produce a crash.

The truck - if you drive it around will produce those vibrations, this did not happen before.

all vehicles have a car joint which is like a upvector joint with tollerance allowes to go on sloped floor, it is based on code you showed me years ago, i can copy source for it.

all vehicle dynamics forces are calculated and applied in forcetorque callback.

EDIT: for the record i have another vehicle with nearly identical setup - 9000 mass, and it works just fine (fire truck)- no shaking-
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 04, 2019 6:18 pm

Ok, I will check tomorrow morning.

Good to know there is another model with same setting that does not has the same problem.

This should not be too hard to find.

We can probably compare with old version, but I do not think is nessesary yet.
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 05, 2019 2:48 am

I updated the example file - i added a fire truck close to start that has nearly identical setup and same mass but does not vibrate.

https://gtamp.com/tdc/tdc_demo_error.7z

To identify when the fault showed up - the game will happily load any newton dll as long as it's functions and callbacks are binary compatible. I do not use newtoncollisiongetinfo that was changed currently ( replaced all relevant calls with NewtonCollisionGetType ) - it will just re-create the map collisions because it assumes a different dll might not be able to load old serialized format.
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 » Mon Dec 09, 2019 2:53 am

Since i was waiting for this, i had a hunch.. i was thinking on what could be related - so i did change the way vehicle dimensions were stored and was thinking if this could affect anything in newton - it does affect the mass matrix as i used that as the source for how vehicle dimensions are calculated. So, i've changed this to using NewtonConvexCollisionCalculateInertialMatrix + NewtonBodySetMassMatrix and the truck vibration has completely stopped.

This doesn't fix the crash tho - the crash still happens and is identically reproduceable in identical way, but at least i figured out one issue and the crash & truck vibration are not the same issue.

I updated the demo to have fixed mass matrixes: the demo still crashes reproducably - just enter the truck and hit forward to crash into the bulldozer.

https://gtamp.com/tdc/tdc_demo_error.7z
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 » Mon Dec 09, 2019 10:35 am

oh I forget to post that when I tried, I had an error loading some resource,
or I did but somehow I did not submited the post, sorry about that.

[OpenAL] Extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFTX_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
>> Audio loaded, all audio buffers: 22.97 Mb
>> Initializing... particle sprites
>> Creating game scene...
>> Initializing script engine...
'TDC.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
>> Loading script...
[BESEN] Exec time = 4 ms
[BESEN] Exec time = 8 ms
[Pickup] Creating trigger rat4 (3) at 55.77000, -91.37000, 1.50000
>> Game is loaded!
>> Done, Mayhem engine is a go!
GPU Mem: 284.16 Mb
>> Logging file list
>> Prefetching Map textures
Exception thrown at 0x00000000 in TDC.exe: 0xC0000005: Access violation executing location 0x00000000.


this is the stack
> 00000000() Unknown
[Frames below may be incorrect and/or missing]
TDC.exe!RENDERALLTEXTURES() Line 5275 C++
TDC.exe!LOADGAME() Line 3591 C++
TDC.exe!FRONTENDEXIT() Line 609 C++
TDC.exe!FRONTENDENTER() Line 0 C++
TDC.exe!LOADED() Line 3621 C++
TDC.exe!ENGINE_CONTEXT_CREATED() Line 2957 C++
TDC.exe!CREATEWINDOWWITHGLCONTEXT() Line 2512 C++
[External Code]
TDC.exe!TDC_GAME_$$_init$() Line 4026 C++
[External Code]


I just downloaded the last repro and is the same. you probably forget to put that asset in the archive
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 10, 2019 1:55 pm

I messed up linking to opengl extension, it was bugged.

I fixed it, here is the new demo: https://gtamp.com/tdc/tdc_demo_error.7z
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 10, 2019 3:54 pm

ok, I will try again tomorrow morning.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgFastRayTest::dgFastRayTest crash (another crash)

Postby Julio Jerez » Wed Dec 11, 2019 10:22 am

Ok I did not see the truck with the problem, but as I walk around, I did get this error wich is fixed now
Code: Select all
File: j:\appbuilder\delfi\top down city\code\tparty\newtonproject\newton-dynamics\sdk\dgcore\dgIntersections.h
Line: 137
Expression: m_diff.DotProduct(m_diff).GetScalar() > dgFloat32 (0.0f)


basically if two bodies tagged as continue collision, in the middle of the solver, the relative velocity becomes zero, the time of impact should be zero.
but if the collsion system try to calculate that time, it will crash or behave very bad because it will try to normalize the relative velocity to get the direction of motion.

In debug you get the assert, but in release you get bad results.
no sure if this is what causes the othe bug, but this is a bad bug that need fixing.
by adding this check, on the loop the bug does not happens.

Code: Select all
                  if (body0->m_continueCollisionMode | body1->m_continueCollisionMode) {
                     dgVector p;
                     dgVector q;
                     dgVector normal;
                     dgVector vrel(body0->m_veloc - body1->m_veloc);
                     dgFloat32 speed2 = vrel.DotProduct(vrel).GetScalar();
                     if (speed2 < dgFloat32(1.0e-2f)) {
                        timeToImpact = dgFloat32(0.0f);
                     } else {
                        timeToImpact = dgMin(timeToImpact, world->CalculateTimeToImpact(contact, timeToImpact, threadID, p, q, normal, dgFloat32(-1.0f / 256.0f)));
                     }
                  }


please check again and if the waving truck is still doing that please tell me hwo do I get to it, because I moved around and I keep dying as soon as I collide with a truck.

edit:
I walk around some more and I see few trucks and people but I did no find the truck with the bug
The big two color truck is one with 9000 mass, but I guess this is the bug one. no sure where ethe secund one is.
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 11, 2019 11:46 am

I resolved truck vibration, that was due to wrong mass matrix, but the crash should still be happening in the demo.

The assert that you got was the one that was a problem!
I now made a git pull, compiled new newton and i cannot get the crash anymore.


I currently cannot reproduce that crash, the only assert that i trigger is:

Program: J:\AppBuilder\Delfi\Top Down City\Game\Libraries\Newton.dll
File: ..\..\dgPhysics\dgBallConstraint.cpp
Line: 165

Expression: pin.m_w == dgFloat32 (0.0f)


picture:
https://i.imgur.com/NpA0kCv.png

Image

This happens when calling NewtonConstraintCreateBall, it happens when attaching trailer onto the truck nearby (the truck that has trailer nehind it to the right of start area)

This didn't crash a few months ago, could it be that fault is because the ball and socket are created inside callbacks? ( i use NewtonWorldForEachBodyInAABBDo to find trailers to attach)
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 11, 2019 12:02 pm

ok, the pin hinge bug is a really bad one, the later vector class does no have dotproduct3 so in a vector has a .w value that is not zero, the results could be really bad
I am late for work now, let us check this one tomorrow morning.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests

cron