Raycast Crash

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Raycast Crash

Postby Carli » Thu Jun 17, 2010 3:55 am

Hi,

an other crash in linux32 newest SDK:

Backtrace:
Code: Select all
#0 dgBody::RayCast(dgLineBox const&, float (*)(dgBody const*, dgVector const&, int, void*, float), unsigned int (*)(dgBody const*, dgCollision const*, void*), void*, float) const at :0
#1 dgSortArray::RayCast(float, dgLineBox const&, float (*)(dgBody const*, dgVector const&, int, void*, float), unsigned int (*)(dgBody const*, dgCollision const*, void*), void*) const at :0
#2 dgBroadPhaseCollision::RayCast(dgVector const&, dgVector const&, float (*)(dgBody const*, dgVector const&, int, void*, float), unsigned int (*)(dgBody const*, dgCollision const*, void*), void*) const at :0
#3 NewtonWorldRayCast at :0
#4 TWORLDOBJECT__RAY({0, -5, 0}) at objectorganization.pas:256


Values for p0 and p1 are:
Code: Select all
 6.871205330E+00  5.940476894E+00  1.276193523E+01
 6.869841099E+00  3.940507889E+00  1.275086594E+01


Code:
Code: Select all
function rayprefilter(const body : PNewtonBody; const collision : PNewtonCollision; userData : Pointer) : cardinal; cdecl;
begin
 result:=integer(TWorldObject(userData).newton<>body);
end;
var closestray: single;
    closestbody: PNewtonBody;
function rayfilter(const body : PNewtonBody; const hitNormal: PFloat; collisionID : Int; userData: Pointer; intersetParam: Float ) : Float; cdecl;
begin
 if intersetParam<closestray then begin
  closestray:=intersetParam;
  closestbody:=body;
 end;
 result:=intersetParam;
end;
function TWorldObject.Ray(pos: TVec3): PNewtonBody;
var matrix: TMatrix4;
    p0, p1: TVec3;
begin
 result:=nil;
 if newton<>nil then begin
  NewtonBodyGetMatrix(newton,@matrix[0][0]); //Matrix holen
  p1:=ApplyMatrixToVec3(matrix,pos); //Zielposition
  p0:=MatrixGetTransform(matrix);
  closestray:=12300000;
  closestbody:=nil;
  NewtonWorldRayCast(NewtonBodyGetWorld(newton), @p0[0], @p1[0], @rayfilter, self, @rayprefilter);
  result:=closestbody;
 end;
end;


The application does not crash when I return 0 at prefilter callback.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Carli » Thu Jun 17, 2010 7:29 am

all other calls of RayCast work fine, this crash is maybe based on some data.

The same data that crash, work with convex cast.

When I negate the "pos" vector, the application does not crash.

Very strangem that newton crashes on some data...
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Thu Jun 17, 2010 8:46 am

that kind of crash is dificult to debug withput a test demo tha can reproduce it exactly.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Carli » Thu Jun 17, 2010 9:23 am

A SEGFAULT crash is always caused by accessing an invalid memory.
You can easily verify if there is any part of the code that could leave to such a crash. (And can be workarounded by assert some invalid values)

@Topic:

the error only occurs on linux32, not on linux64 or win32.
In the no-crash-versions, the RayFilter-Callback passes 0 as its first intersectparam.

my idea is that it occurs when the ray start is exactly on the face of a cube (box).
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Thu Jun 17, 2010 10:39 am

you say it crash when you cast with some values.
so unless I can run teh same sate you are running I will no be able to see waht it is.

for what you say it is a very specific data realetd bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Carli » Thu Jun 17, 2010 12:28 pm

but it's curious that it only crashes on linux32, on all other systems, it returns no found bodies.
So, do you want to have a windows or a linux version of the crashing program?
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Thu Jun 17, 2010 1:20 pm

That's another reason why it needs a test demo.
you it crashes in Linux 32, so Linux 32 should be.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Carli » Thu Jun 17, 2010 3:04 pm

http://www.file-upload.net/download-260 ... m.rar.html

i already set up your user name and your language ;)

i added a windows cross build so that you can test on windows, too.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Carli » Mon Jun 21, 2010 11:32 am

Did you find a reason?
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Mon Jun 21, 2010 11:41 am

No I did not have time this week end. I see if I can do tonight
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Julio Jerez » Mon Jun 28, 2010 1:27 pm

Oh I forget this again, I will try tonight.

I am wroking on a project that si taking lot of my free time.
But I will check this tonight I promise .
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Carli » Sat Jul 03, 2010 10:49 am

Did you at least download the zip so that it will not exceed the date till it will be removed?
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Sat Jul 03, 2010 1:39 pm

Ok I have the demo I run the newton Crash in my PC I do not see any crash.
what do I need to do to make it crash?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Raycast Crash

Postby Carli » Sat Jul 03, 2010 3:06 pm

Do you see the bird? it does not fly.

It is a convex hull where the ray starts in and a large box where the ray should stop.
But it does not detect the box. (and crashes on my netbook)
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Raycast Crash

Postby Julio Jerez » Sat Jul 03, 2010 4:25 pm

I see a map with few thong on teh floor and the map is spinning,
show I see a flighing object righ away ?
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