Access violation CalculateForcesGameMode

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 6:33 am

Hello !
yes it's me again :)

I ran into an access violation in dgWorldDynamicUpdate::CalculateForcesGameMode.
On line 896 the m_joint data of jointInfo is invalid :/

Image
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby manny » Mon Sep 22, 2014 7:35 am

hi again :)

0xfeeefeee is used by MSVC's heap to mark a region that has been free'd. So you seem to have deleted that joint after passing it to newton.

BTW, we're also have an irc channel at irc.freenode.net #newtondynamics ;)
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm

Re: Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 8:32 am

Yes but I didn't destroyed anything yet :/ strange
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 9:20 am

Ok my bad ^^
I found it the problem was a missing criticalSectionLock.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 1:43 pm

In fact I still have the problem.
in release mode this end with a pure virtual function call exception. it seems to not doing it without asyncUptade.

I could reproduce this error (don't know if this is the same) on the demoSandBox with "simple convex fracture"
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 3:28 pm

the bug in the demo is a null pointer on a body in the mouse pick function.
Don't seems related to my problem ^^

(the boolean demo also crash on load)
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby arkeon » Mon Sep 22, 2014 5:46 pm

In fact this is an another scaling issue. all the problem is gone when I remove scaling.

Here a simple demo that produce the problem : http://arkeon.dyndns.org/scol/scaling_joints.rar
the strange thing is that is seems to have nothing scaled in this scene but to 1 ratio.
the only difference with noscale mode is that NewtonCollisionSetMatrix and NewtonBodySetCollisionScale are called.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 11:03 am

when I run scaling_joints.exe I see a dummy skeleton connected by rigid joint than fall on his back.
I did not get any crash.
what I have to do to make it crash?
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Access violation CalculateForcesGameMode

Postby arkeon » Wed Sep 24, 2014 11:10 am

to get the crash you can add more joints
int the file partition\tools\os3dplugins\physic\physicstructure\cphysicstructure.pkg
remove the line : 204 "if (stage > 4) then nil else" all the skeleton bones will be created showing the Async collision crash.

if I remove scaling the bodies act correctly.

But I got some other cases where I got the crash also without scaling.
If I remove AsyncUpdate and scaling all get correct.

It seems that collisions joint get destroyed without cleared. maybe by an another island thread ?
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 11:57 am

ok I fix the crash bug in Camera listener

basically when I replace the force a torque call back, I also remove the part that hooked a destructor call back.

This is necessary because when to mick a body, you are holding to it, if the body is destroyed by some call back. and some other call back is also has a reference to that body. the that body will operate of a dangling pointer.

The way this is dealt with in newton is that a body has a destructor call back that is call before a body is going to be removed for the scene.

System can chain destructors call back similar to how C++ does for subclasses, and the are call in order. When I made the change to remove the function for you to use, also remove that part of the code. It is back on again.

Please sync so that you can see how it is used. the files are:
C:\Development\newton-dynamics\applications\demosSandbox\sdkDemos\DemoCameraListener.h
C:\Development\newton-dynamics\applications\demosSandbox\sdkDemos\DemoCameraListener.cpp

I do no think that is you bug, but I think it is some similar thong when a body is destroyed but no other system is notified.

Did you put a destructor callback on your bodies?
if so can you set a break point on the destructor and see if Is called before the crash happened.


I will add a new function to newton.
On listener destroybody callback.
The way I can also remove the destructor chaining mombojoumbo, I can see how that is more complex that is needs to be, and cal also get out order.
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Access violation CalculateForcesGameMode

Postby arkeon » Wed Sep 24, 2014 12:07 pm

Yes I have a destructor callback.

but at this time when the crash happen I don't destroy any body or joint, I just let the simulation playing :/

In which scenarios newton can destroy bodies itself ?
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 12:22 pm

no newton does no destroy bodies.

I am adding the change to the listen and I will see what it is them.
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 12:56 pm

Ok I added the onListener destroy callback to the engine.
this is a more elegant way to remove bodies form system that has reference to a body and the body is destroyed.
you will have to sync and link the dll to the demo, because it will crash on entry since I added a new function.

please do that, also if you can make so that is cash with me having to change the file, that will be easier for me to test.
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 1:04 pm

I do not know if it Is because the new dll has more functions, or not, but I think you still have problem with the picking code.

for some reason it is still adding force of the order quadrillions of newton to the pick body.

are you using the function I gave you or are you still converting delta positions to velocities by dividing by the time step?
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Access violation CalculateForcesGameMode

Postby Julio Jerez » Wed Sep 24, 2014 1:05 pm

has you look at the RagDoll demo to see how I setup those ragdools?
Julio Jerez
Moderator
Moderator
 
Posts: 11046
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 1 guest