From: Matthias B. <ba...@ir...> - 2004-11-06 13:44:03
|
Sorry for not replying earlier, I've been too busy once more... Timothy Stranex wrote: >>Also attached is the file named tutorial3_osg_segfault.py. This file will crash when you >>run it because it seems that if more than 34 bodies collide at once (at least on the first >>frame if they are all intersecting), then pyODE will crash by segmentation fault. > > After testing it on my computer, it segfaults if here are more than 68 > objects. I've done some looking but I can't work out what's causing it. > The segfault occurs in world.step() or world.quickStep(). My > investigation found two potential problems: > > 1. Body.setMass() takes a Mass object argument. It doesn't keep a > reference to it but uses its dMass Mass._mass for dBodySetMass(dBodyID, > const dMass *mass). If the Mass object is deallocated, ODE could still > try to access it. > > 2. ContactJoint uses Contact objects for ODE calls without keeping > references. ODE might still try to access it even if the Contact object > has been deallocated. The mass properties and the contact structure are copied when calling dBodySetMass()/dJointCreateContact(), so ODE won't access the original data after the calls. So that's not the problem. As I haven't PyOSG running on Windows, I just stripped away the PyOSG stuff and could also run the file. It crashes as well when using more than 32 bodies (or more than 9 bodies if I use step() instead of quickstep()). I counted the contact joints that are generated in the near_callback() function and once there are more than about 2000 contacts the dWorldQuickStep() function will crash (dWorldStep() already crashes once there are more than 120 contacts). So far, I'd say the bug is in ODE, not PyODE. Maybe this is the stack size issue that occasionally comes up in the ODE mailing list? Could it be that the stack overflows when the number of contacts gets too large? - Matthias - PS: Concerning PyOSG on Windows.... I did a test with a simple Pyrex file and Visual Studio .NET to see if the compiled module will be accepted by Python. I was using the distutils to compile the module and when calling the setup script, it complained about the compiler version. So it seems if you want to run PyOSG on Windows you also have to compile Python yourself (unless it's possible either to compile OSG with VC6 or to use the OSG binaries with VC6). But at least I could run some PyOSG demos with the CD image that Brett has provided. :) (unfortunately, the 3D output doesn't seem to be hardware accelerated) |