Random crash in dgWorld::CreateNewtonSkeletonContainer

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Boost113 » Sat Oct 27, 2018 3:17 pm

Hi,

After updating to the latest master branch version I'm still getting crashes in:
Code: Select all
0 in dgWorld::CreateNewtonSkeletonContainer(dgBody*) of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgWorld.cpp:1127
1 in dgWorld::UpdateSkeletons of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgWorld.cpp:1319
2 in dgWorld::StepDynamics of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgWorld.cpp:906
3 in dgWorld::RunStep of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgWorld.cpp:984
4 in dgMutexThread::Execute of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgCore/dgMutexThread.cpp:59
5 in dgThread::dgThreadSystemCallback(void*) of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgCore/dgThread.cpp:170
6 in execute_native_thread_routine of /lib64/libstdc++.so.6
7 in start_thread of /lib64/libpthread.so.0
8 in clone of /lib64/libc.so.6


The variable m_skeleton is null at that point:
Code: Select all
Thread 77 "Thrive" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffeb0699700 (LWP 4205)]
dgWorld::CreateNewtonSkeletonContainer(dgBody*) () at /home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgWorld.cpp:1127
1127            skeleton->m_id = index;
(gdb) p skeleton
$1 = (dgSkeletonContainer * const) 0x0


As far as I can tell all other threads are stopped waiting for something so I don't think this is a race condition.

Edit: after looking through other issues I found that this is a duplicate of: https://github.com/MADEAPPS/newton-dynamics/issues/132 (viewtopic.php?f=12&t=9327)
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Boost113 » Sat Oct 27, 2018 4:01 pm

I tried doing a simple fix like this:
Code: Select all
            if(skeleton){
           
                skeleton->m_id = index;
                list->Insert (skeleton, skeleton->GetId());
            }


But now I get crashes when skeleton isn't null but it still isn't a valid pointer:
Code: Select all
$2 = (dgSkeletonContainer * const) 0x6600323266003232
(gdb) p *skeleton
Cannot access memory at address 0x6600323266003232
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Julio Jerez » Sat Oct 27, 2018 7:14 pm

so this is a Linux build, we did not have a Linux build until yesterday.
did you make your own make file?

I do not have a way to debug bug in Linux since I do not have a Linux box, but I think I know what this is and I will try to get it fix.
Julio Jerez
Moderator
Moderator
 
Posts: 10995
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Julio Jerez » Sat Oct 27, 2018 7:19 pm

my guess is that the crash happen because the
if (dgSkeletonContainer::m_uniqueID > 1014 * 16) {
is wrapping around and an is will produce unpredictable results, so adding a hack will not fix it.
are you making many jointed objects?

what I need to do is to re write the Skeleton generation in a state less manner that does now uses unique ids.
Julio Jerez
Moderator
Moderator
 
Posts: 10995
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Boost113 » Sun Oct 28, 2018 5:34 am

I fixed the cmake build myself (I posted in another thread about it).

The only objects I create and destroy a lot are NewtonCreateCompoundCollision which has a few spheres as the child collisions. I constraint them to a 2d plane with a joint so that is probably where the lot of joints come from.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Julio Jerez » Sun Oct 28, 2018 12:27 pm

there is and obviouss bug that may be the cause,
you see the line that check if the unique I'd in larger than 1014 * 16

it should be 1024 * 16.

could you try making that change, until I re write that function.
that is centrally wrong and can cause bit from one mask to cross over to the other mask.

me bad for using one internet to hold two variable s, that really bad, and will be fixed.
Julio Jerez
Moderator
Moderator
 
Posts: 10995
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Julio Jerez » Mon Oct 29, 2018 9:54 am

ok as a first test before I go on to re write that funtion, I commite the type on like 1014 * 16
that was certainly a bug even when the function is not very smart.

can you please try again, this will happens when creating and destroying many joints.
It has nothing to do with compound of any other collision at all.
Julio Jerez
Moderator
Moderator
 
Posts: 10995
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Boost113 » Mon Oct 29, 2018 9:57 am

I tried changing that one line but I still got crashes.

I'm not fully sure I actually got the change to take effect as I only quickly tried it. But I'm pretty sure that it loaded the new version. Maybe it took a slightly longer time for it to crash, but it varied quite a bit even beforehand.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Random crash in dgWorld::CreateNewtonSkeletonContainer

Postby Julio Jerez » Mon Nov 05, 2018 1:42 pm

alright this is now fixed. Later I will enable the optimization but for now this is the solution.
Julio Jerez
Moderator
Moderator
 
Posts: 10995
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests