[SOLVED] 20x20 grid of spheres causes segmentation fault.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[SOLVED] 20x20 grid of spheres causes segmentation fault.

Postby hach-que » Sun Jan 25, 2009 6:37 am

This is a continuation from my terrain topic, but since the terrain wasn't the problem, I figured I'd mark it as solved and have a topic dedicated to this issue. Hope that doesn't cause any problems ;)

My problem is actually being caused by a loop where I'm adding a 20x20 grid of spheres, however I know for a fact that the Newton body is not being destroyed and I really don't know why the segmentation fault occurs.

I'm using Lua, and binding Irrlicht and Newton to it. The Lua code I am using to create the spheres which cause the segmentation fault is:
Code: Select all
node = {};
for x = 0, 20, 1 do
   for y = 0, 19, 1 do
      print("Creating object in index " .. ((x*20)+y) .. "....");
      node[(x*20)+y] = device:getSceneManager():addSphereSceneNode(Core.Vector3D(x,500,y),Core.Vector3D(0,0,0),Core.Vector3D(2,2,2),50);
      node[(x*20)+y]:applyPhysicsSettings(0.1, Core.Vector3D(0.1,0.1,0.1));
      if (tex_b1 ~= nil) then
         node[(x*20)+y]:applyTexture(tex_b1,0);
      end
      node[(x*20)+y]:applyFlag("LIGHTING",false);
   end
end


I do know this:
  • Lua is not garbage collecting the object.
  • The physics body wrapper is not being destroyed.
  • The physics body is not being destroyed by any of my code.
  • The segmentation fault occurs inside NewtonUpdate at 0035ee53()
  • The terrain code works fine, and the segmentation fault still occurs when I create just the 20x20 grid.
  • It only happens in the for loop. I can place the code twice to generate two objects and it doesn't crash (I can even override the Lua variable pointing to the first one and it doesn't crash).

I don't know:
  • Whether expanding the Lua code 400 times would solve the problem.
  • What function is at 0035ee53 (for obvious reasons. I'm really hoping Julio can tell me)
  • What alpha version of 2.00 I'm using (if there are multiple versions, there doesn't seem to be a way to tell from Newton.h other than possibly the NEWTON_H__736495_6495_076__INCLUDED_ at the top)

I'm hoping someone can help me resolve this problem as soon as possible.
Last edited by hach-que on Mon Jan 26, 2009 8:13 am, edited 1 time in total.
User avatar
hach-que
 
Posts: 27
Joined: Fri Jun 13, 2008 2:11 am

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby agi_shi » Sun Jan 25, 2009 8:39 am

Are you using x64 Linux? There was a crash in the older betas, but the newest version has it fixed.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby Julio Jerez » Sun Jan 25, 2009 11:14 am

I do now know what could be at 0035ee53() either.

there are demos in the SDK with more thanb 400 objects that do no crash
has you tried adding the 400 ball no using Lua?

try that and if still crash maybe you can recreate a sample to reproduce it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby hach-que » Sun Jan 25, 2009 7:11 pm

agi_shi wrote:Are you using x64 Linux? There was a crash in the older betas, but the newest version has it fixed.


I'm using Windows. Julio gave me version 2.00 on Tue Jul 01, 2008. Whatever version was available then is the one I'm working with now.

I can run all the demos (except Motorized Robots, I had to disable that because it wouldn't compile with it on).

I'll see if I can reproduce the problem without Lua, but as stated, there's no way Lua can be affecting Newton.
User avatar
hach-que
 
Posts: 27
Joined: Fri Jun 13, 2008 2:11 am

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby agi_shi » Sun Jan 25, 2009 7:13 pm

Woah, that sounds really old, upgrade to the current beta (it's stickied).
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby hach-que » Sun Jan 25, 2009 7:32 pm

Okay, I didn't see that there ;) I'll let you know if it works with the new version.

EDIT: Can't seem to download the rar file. It just gets a 0 length file from the server >_>
Last edited by hach-que on Sun Jan 25, 2009 7:59 pm, edited 1 time in total.
User avatar
hach-que
 
Posts: 27
Joined: Fri Jun 13, 2008 2:11 am

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby Julio Jerez » Sun Jan 25, 2009 7:42 pm

Oh there has being more than one beta after that, please get the latest and test again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [UNSOLVED] 20x20 grid of spheres causes segmentation fault.

Postby hach-que » Mon Jan 26, 2009 2:41 am

I've just downloaded it then, and put it into my application. Good news is, it doesn't crash. Bad news is, nothing collides with the terrain. I made a grid 40x40 of balls spaced 20 units apart, and none of them collide with the terrain.

EDIT: Nevermind, seems to be a problem with Irrlicht returning no indices on the terrain, for which I have a safety check.
User avatar
hach-que
 
Posts: 27
Joined: Fri Jun 13, 2008 2:11 am

Re: [SOLVED] 20x20 grid of spheres causes segmentation fault.

Postby Julio Jerez » Mon Jan 26, 2009 9:28 am

why don't you try first one ball in a simple mesh, and implement debug display?
It will save you lot of trial and error.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] 20x20 grid of spheres causes segmentation fault.

Postby hach-que » Mon Jan 26, 2009 5:50 pm

Because my application has a Lua interface, with which the 3D and physics engines are controlled, it's very hard to implement. Doesn't matter though, because I got it work (just it's really slow).
User avatar
hach-que
 
Posts: 27
Joined: Fri Jun 13, 2008 2:11 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 19 guests

cron