I just had a go with the DLL containing the implementation of finalizeNative. When the 64th KinematicRagdollControl gets added to a PhysicsSpace (using parallel threading) I still get an EXCEPTION_ACCESS_VIOLATION, but it’s no longer complaining about UnsatisfiedLinkErrors. It’s now complaining about PrivilegedActionExceptions and something called “implicit null exceptions”:
Event: 3.219 Thread 0x0000000059d7b000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e1774410) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.220 Thread 0x0000000059d7b000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e1775038) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 19.476 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000031f4e36 to 0x00000000031f5819
Event: 25.686 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000036b48b1 to 0x00000000036b4b9d
Event: 25.686 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000035ca612 to 0x00000000035caa12
Event: 25.686 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000036b0afc to 0x00000000036b0d39
Event: 25.687 Thread 0x0000000059d7b000 Implicit null exception at 0x000000000361f030 to 0x000000000361f6cd
Event: 25.702 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000036e9ab4 to 0x00000000036ea4d9
Event: 26.006 Thread 0x0000000059d7b000 Implicit null exception at 0x000000000370e5c5 to 0x0000000003710e25
Event: 28.600 Thread 0x0000000059d7b000 Implicit null exception at 0x00000000035ec0cf to 0x00000000035ed525
I don’t know whether that’s due to an error in the implementation of finalizeNative, or something completely different.
Before I created this topic, and tried to write a simple app to reproduce the EXCEPTION_ACCESS_VIOLATION I was getting. I was intending it to add a KinematicRagdollControl to a PhysicsSpace 64 times. However, instead, I found that I got an EXCEPTION_ACCESS_VIOLATION just trying to do one ragdoll. The body of the app is given below.
private Spatial model;
private BulletAppState bulletAppState;
@Override
public void simpleInitApp() {
cam.setLocation(new Vector3f(0, 4, 18));
/** A white ambient light source. */
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White);
rootNode.addLight(ambient);
/** A white, directional light source */
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
loadModel();
createBulletAppState();
addFloor();
startRagdoll();
}
private void loadModel() {
model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
model.setLocalTranslation(0, 10, 0);
rootNode.attachChild(model);
}
private void createBulletAppState() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
}
private void addFloor() {
Plane plane = new Plane(Vector3f.UNIT_Y, 0);
CollisionShape shape = new PlaneCollisionShape(plane);
PhysicsRigidBody floor = new PhysicsRigidBody(shape, 0);
bulletAppState.getPhysicsSpace().add(floor);
}
private void startRagdoll() {
KinematicRagdollControl control = new KinematicRagdollControl();
model.addControl(control);
bulletAppState.getPhysicsSpace().add(control);
control.setRagdollMode();
}
Running this, if I use native Bullet, I get an EXCEPTION_ACCESS_VIOLATION; if I use jBullet, it works absolutely fine. Does that fall over with native Bullet for anyone else? The funny thing is, my game has ragdolls, so it’s not as if my computer is too old to do ragdolls or something (although it is old). The internal exceptions I get in this case are:
Event: 0.438 Thread 0x00000000024b8000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000e04e7798) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 0.441 Thread 0x00000000024b8000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000e04f4ae8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 0.546 Thread 0x0000000059ca5000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e0679a58) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.688 Thread 0x0000000059ca5000 Exception <a 'java/lang/NoClassDefFoundError'> (0x00000000e07195c8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1394]
Event: 3.104 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e17018a8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.104 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e1703418) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.104 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e1704538) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.105 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e1709658) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.105 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e170a2b0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Event: 3.105 Thread 0x0000000059fdc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e170aed8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u161\10277\hotspot\src\share\vm\prims\jvm.cpp, line 1390]
Again, they include PrivilegedActionExceptions. So, when I run my game with the latest bulletjme.dll, and get an EXCEPTION_ACCESS_VIOLATION caused by PrivilegedActionExceptions, unfortunately I’m not in a position to say whether that’s because there’s something wrong with the implementation of finalizeNative, or whether it’s due to whatever causes that test app to not work for me either.