Some IndexOutOfBoundsException

I get this exception only sometimes:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,10,main]
[java]
java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:518)
at java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:340)
at com.bulletphysics.collision.shapes.ByteBufferVertexData.getIndex(ByteBufferVertexData.java:78)
at com.bulletphysics.collision.shapes.VertexData.getTriangle(VertexData.java:53)
at com.bulletphysics.collision.shapes.BvhTriangleMeshShape$MyNodeOverlapCallback.processNode(BvhTriangleMeshShape.java:265)
at com.bulletphysics.collision.shapes.OptimizedBvh.walkStacklessQuantizedTree(OptimizedBvh.java:955)
at com.bulletphysics.collision.shapes.OptimizedBvh.reportAabbOverlappingNodex(OptimizedBvh.java:703)
at com.bulletphysics.collision.shapes.BvhTriangleMeshShape.processAllTriangles(BvhTriangleMeshShape.java:163)
at com.bulletphysics.collision.dispatch.ConvexConcaveCollisionAlgorithm.processCollision(ConvexConcaveCollisionAlgorithm.java:86)
at com.bulletphysics.collision.dispatch.CompoundCollisionAlgorithm.processCollision(CompoundCollisionAlgorithm.java:120)
at com.bulletphysics.collision.dispatch.DefaultNearCallback.handleCollision(DefaultNearCallback.java:55)
at com.bulletphysics.collision.dispatch.CollisionDispatcher$CollisionPairCallback.processOverlap(CollisionDispatcher.java:236)
at com.bulletphysics.collision.broadphase.HashedOverlappingPairCache.processAllOverlappingPairs(HashedOverlappingPairCache.java:190)
at com.bulletphysics.collision.dispatch.CollisionDispatcher.dispatchAllCollisionPairs(CollisionDispatcher.java:247)
at com.bulletphysics.collision.dispatch.CollisionWorld.performDiscreteCollisionDetection(CollisionWorld.java:150)
at com.bulletphysics.dynamics.DiscreteDynamicsWorld.internalSingleStepSimulation(DiscreteDynamicsWorld.java:378)
at com.bulletphysics.dynamics.DiscreteDynamicsWorld.stepSimulation(DiscreteDynamicsWorld.java:339)
at com.jme3.bullet.PhysicsSpace.update(PhysicsSpace.java:330)
at com.jme3.bullet.PhysicsSpace.update(PhysicsSpace.java:317)
at com.jme3.bullet.BulletAppState.render(BulletAppState.java:243)
at com.jme3.app.state.AppStateManager.render(AppStateManager.java:274)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:251)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:662)
[/java]
Any idea why before I might dive into the source code? As always, I have googled this exception beforehand but came up with nothing like it. The only thing I can guess from it is that it has something to do with the mesh index buffer…

I’m having a feeling that it’s about multithreading yet again after many attempts in fixing. The exception seems to stop when I basically only use the main thread.

Yeah, you’re right. Some buffer is too small.
Only time I got this was while making silly small spheres… Much too small !

In your case, I fear you have to put an exception breakpoint and trace back to where it come from.
Since some parts of the physics are not source-included, you will probably have a hard time :(.

Good luck!