jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.84k stars 1.13k forks source link

native Bullet crash while removing body from BroadphaseType.SIMPLE PhysicsSpace #1058

Closed stephengold closed 4 years ago

stephengold commented 5 years ago

I hope to use BroadphaseType.SIMPLE in my game because I believe it is more efficient in some situations. However, in the current master branch, the test app below crashes in native Bullet while attempting to remove body1 from physicsSpace.

package jme3test.bullet;

import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.PhysicsTickListener;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.collision.shapes.SphereCollisionShape;
import com.jme3.bullet.objects.PhysicsRigidBody;

/**
 * Test case for JME issue #10xx: native Bullet crash while removing a rigid
 * body from a BroadphaseType.SIMPLE PhysicsSpace.
 * <p>
 * If successful, the app will complete normally.
 *
 * @author Stephen Gold sgold@sonic.net
 */
public class TestIssue10XX
        extends SimpleApplication
        implements PhysicsTickListener {

    private volatile boolean hasStepped = false;
    private PhysicsRigidBody body1;
    private PhysicsRigidBody body2;
    private PhysicsSpace physicsSpace;

    public static void main(String[] arguments) {
        Application application = new TestIssue10XX();
        application.start();
    }

    @Override
    public void simpleInitApp() {
        BulletAppState bulletAppState = new BulletAppState();
        bulletAppState.setBroadphaseType(PhysicsSpace.BroadphaseType.SIMPLE);
        stateManager.attach(bulletAppState);

        physicsSpace = bulletAppState.getPhysicsSpace();
        physicsSpace.addTickListener(this);

        CollisionShape shape = new SphereCollisionShape(1f);

        body1 = new PhysicsRigidBody(shape, 1f);
        physicsSpace.add(body1);

        body2 = new PhysicsRigidBody(shape, 2f);
        physicsSpace.add(body2);
    }

    @Override
    public void simpleUpdate(float tpf) {
        super.simpleUpdate(tpf);
        if (hasStepped) {
            physicsSpace.remove(body1); // native Bullet crash occurs here
            physicsSpace = null;
            stop();
        }
    }

    @Override
    public void prePhysicsTick(PhysicsSpace space, float tpf) {
        // do nothing
    }

    @Override
    public void physicsTick(PhysicsSpace space, float tpf) {
        hasStepped = true;
    }
}
stephengold commented 5 years ago

Here's a typical crash log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fee5832c9a, pid=2208, tid=0x0000000000001810
#
# JRE version: Java(TM) SE Runtime Environment (8.0_181-b13) (build 1.8.0_181-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.181-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [bulletjme.dll+0x22c9a]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x0000000058ebc000):  JavaThread "jME3 Main" [_thread_in_native, id=6160, stack(0x000000005e510000,0x000000005e610000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000118

Registers:
RAX=0x0000000000000000, RBX=0x00000000570def80, RCX=0x0000000000000000, RDX=0x0000000061c60050
RSP=0x000000005e60ead8, RBP=0x000000005e60ee58, RSI=0x0000000000000298, RDI=0x0000000000000001
R8 =0x0000000061c600a0, R9 =0x000000006250d9c0, R10=0x0000000002928bfb, R11=0x00000000613ec6a0
R12=0x0000000000000000, R13=0x00000000570def80, R14=0x000000005e60ee98, R15=0x0000000058ebc000
RIP=0x000007fee5832c9a, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x000000005e60ead8)
0x000000005e60ead8:   000007fee5923753 0000000000000000
0x000000005e60eae8:   0000000063e70060 00000000617bab88
0x000000005e60eaf8:   00000000021196b0 0000000000000001
0x000000005e60eb08:   000007fee592365c 0000000000000000
0x000000005e60eb18:   000007fee58998f6 000000005a905de8
0x000000005e60eb28:   0000000000000000 0000000000000002
0x000000005e60eb38:   0000000000000003 0000000000000000
0x000000005e60eb48:   0000000062513230 000000005bdbdc80
0x000000005e60eb58:   000007fee5897d2f 000000005a74c230
0x000000005e60eb68:   0000000061c60050 0000000061c600a0
0x000000005e60eb78:   000000006250d9c0 ffffffff00000000
0x000000005e60eb88:   0000000000000000 000000015bdbdcf0
0x000000005e60eb98:   000000005be10f00 0000000300000000
0x000000005e60eba8:   ccd1384b58b00f80 0000000000000002
0x000000005e60ebb8:   0000000000000000 000007fee599aee8
0x000000005e60ebc8:   000000006244d9b0 0000000000000006 

Instructions: (pc=0x000007fee5832c9a)
0x000007fee5832c7a:   19 00 48 83 c4 58 c3 cc cc cc cc cc cc cc cc cc
0x000007fee5832c8a:   cc cc cc cc cc cc 48 89 4c 24 08 48 8b 44 24 08
0x000007fee5832c9a:   8b 80 18 01 00 00 c3 cc cc cc cc cc cc cc cc cc
0x000007fee5832caa:   cc cc cc cc cc cc 48 89 4c 24 08 48 8b 44 24 08 

Register to memory mapping:

RAX=0x0000000000000000 is an unknown value
RBX={method} {0x00000000570def88} 'removeRigidBody' '(JJ)V' in 'com/jme3/bullet/PhysicsSpace'
RCX=0x0000000000000000 is an unknown value
RDX=0x0000000061c60050 is an unknown value
RSP=0x000000005e60ead8 is pointing into the stack for thread: 0x0000000058ebc000
RBP=0x000000005e60ee58 is pointing into the stack for thread: 0x0000000058ebc000
RSI=0x0000000000000298 is an unknown value
RDI=0x0000000000000001 is an unknown value
R8 =0x0000000061c600a0 is an unknown value
R9 =0x000000006250d9c0 is an unknown value
R10=0x0000000002928bfb is at code_begin+891 in an Interpreter codelet
method entry point (kind = native)  [0x0000000002928880, 0x0000000002929240]  2496 bytes
R11=0x00000000613ec6a0 is an unknown value
R12=0x0000000000000000 is an unknown value
R13={method} {0x00000000570def88} 'removeRigidBody' '(JJ)V' in 'com/jme3/bullet/PhysicsSpace'
R14=0x000000005e60ee98 is pointing into the stack for thread: 0x0000000058ebc000
R15=0x0000000058ebc000 is a thread

Stack: [0x000000005e510000,0x000000005e610000],  sp=0x000000005e60ead8,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [bulletjme.dll+0x22c9a]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.jme3.bullet.PhysicsSpace.removeRigidBody(JJ)V+0
j  com.jme3.bullet.PhysicsSpace.removeRigidBody(Lcom/jme3/bullet/objects/PhysicsRigidBody;)V+139
j  com.jme3.bullet.PhysicsSpace.removeCollisionObject(Lcom/jme3/bullet/collision/PhysicsCollisionObject;)V+30
j  com.jme3.bullet.PhysicsSpace.remove(Ljava/lang/Object;)V+91
j  jme3test.bullet.TestIssue1058.simpleUpdate(F)V+20
j  com.jme3.app.SimpleApplication.update()V+82
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j  com.jme3.system.lwjgl.LwjglDisplay.runLoop()V+104
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+136
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00000000598df000 JavaThread "jME3 Audio Decoder" daemon [_thread_blocked, id=6320, stack(0x0000000063d70000,0x0000000063e70000)]
  0x00000000020cd000 JavaThread "DestroyJavaVM" [_thread_blocked, id=4676, stack(0x0000000002540000,0x0000000002640000)]
=>0x0000000058ebc000 JavaThread "jME3 Main" [_thread_in_native, id=6160, stack(0x000000005e510000,0x000000005e610000)]
  0x0000000059e74800 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=740, stack(0x000000005d050000,0x000000005d150000)]
  0x0000000059a4a000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=968, stack(0x000000005a360000,0x000000005a460000)]
  0x0000000059a48800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3264, stack(0x000000005a120000,0x000000005a220000)]
  0x0000000058b54800 JavaThread "Service Thread" daemon [_thread_blocked, id=4144, stack(0x00000000595b0000,0x00000000596b0000)]
  0x0000000058ad1800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=1580, stack(0x00000000592c0000,0x00000000593c0000)]
  0x0000000058ad0000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5572, stack(0x0000000059420000,0x0000000059520000)]
  0x0000000058acb000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=5356, stack(0x00000000591b0000,0x00000000592b0000)]
  0x0000000058ac7800 JavaThread "Attach Listener" daemon [_thread_blocked, id=5176, stack(0x00000000590b0000,0x00000000591b0000)]
  0x00000000576be800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5360, stack(0x0000000058ec0000,0x0000000058fc0000)]
  0x00000000576a2800 JavaThread "Finalizer" daemon [_thread_blocked, id=5116, stack(0x00000000589c0000,0x0000000058ac0000)]
  0x000000005765b800 JavaThread "Reference Handler" daemon [_thread_blocked, id=5500, stack(0x0000000058850000,0x0000000058950000)]

Other Threads:
  0x0000000057654000 VMThread [stack: 0x0000000058640000,0x0000000058740000] [id=5216]
  0x0000000058bca800 WatcherThread [stack: 0x00000000597a0000,0x00000000598a0000] [id=5908]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 PSYoungGen      total 38400K, used 24890K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 74% used [0x00000000d5700000,0x00000000d6f4e860,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
  to   space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 18176K, capacity 18451K, committed 18560K, reserved 1064960K
  class space    used 2104K, capacity 2171K, committed 2176K, reserved 1048576K

Card table byte_map: [0x0000000011cd0000,0x00000000120d0000] byte_map_base: 0x00000000118ce000

Marking Bits: (ParMarkBitMap*) 0x00000000619e2d00
 Begin Bits: [0x00000000128e0000, 0x00000000148d0000)
 End Bits:   [0x00000000148d0000, 0x00000000168c0000)

Polling page: 0x0000000000330000

CodeCache: size=245760Kb used=4509Kb max_used=4509Kb free=241250Kb
 bounds [0x0000000002910000, 0x0000000002d80000, 0x0000000011910000]
 total_blobs=1925 nmethods=1269 adapters=569
 compilation: enabled

Compilation events (10 events):
Event: 14.255 Thread 0x0000000058ad1800 1265   !   3       java.lang.ClassLoader::findNative (86 bytes)
Event: 14.256 Thread 0x0000000058ad1800 nmethod 1265 0x0000000002d75610 code [0x0000000002d757c0, 0x0000000002d76058]
Event: 14.263 Thread 0x0000000058ad1800 1266       1       com.jme3.material.MatParam::getValue (5 bytes)
Event: 14.264 Thread 0x0000000058ad1800 nmethod 1266 0x0000000002d73910 code [0x0000000002d73a60, 0x0000000002d73b70]
Event: 14.266 Thread 0x0000000058ad1800 1267       3       java.util.Locale::getLanguage (8 bytes)
Event: 14.266 Thread 0x0000000058ad1800 nmethod 1267 0x0000000002d73490 code [0x0000000002d735e0, 0x0000000002d737d0]
Event: 14.271 Thread 0x0000000058ad1800 1268       1       com.jme3.util.NativeObject::getId (5 bytes)
Event: 14.271 Thread 0x0000000058ad1800 nmethod 1268 0x0000000002d79b10 code [0x0000000002d79c60, 0x0000000002d79d70]
Event: 14.274 Thread 0x0000000058ad1800 1269       3       java.nio.HeapByteBuffer::ix (7 bytes)
Event: 14.274 Thread 0x0000000058ad1800 nmethod 1269 0x0000000002d79dd0 code [0x0000000002d79f20, 0x0000000002d7a070]

GC Heap History (8 events):
Event: 7.396 GC heap before
{Heap before GC invocations=1 (full 0):
 PSYoungGen      total 38400K, used 13686K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 41% used [0x00000000d5700000,0x00000000d645da60,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
  to   space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
 ParOldGen       total 87552K, used 0K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 0% used [0x0000000080400000,0x0000000080400000,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
Event: 7.403 GC heap after
Heap after GC invocations=1 (full 0):
 PSYoungGen      total 38400K, used 3910K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 76% used [0x00000000d7780000,0x00000000d7b519b0,0x00000000d7c80000)
  to   space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
 ParOldGen       total 87552K, used 16K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 0% used [0x0000000080400000,0x0000000080404000,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
}
Event: 7.403 GC heap before
{Heap before GC invocations=2 (full 1):
 PSYoungGen      total 38400K, used 3910K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 76% used [0x00000000d7780000,0x00000000d7b519b0,0x00000000d7c80000)
  to   space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
 ParOldGen       total 87552K, used 16K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 0% used [0x0000000080400000,0x0000000080404000,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
Event: 7.433 GC heap after
Heap after GC invocations=2 (full 1):
 PSYoungGen      total 38400K, used 0K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
  to   space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
}
Event: 7.433 GC heap before
{Heap before GC invocations=3 (full 1):
 PSYoungGen      total 38400K, used 0K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
  to   space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
Event: 7.434 GC heap after
Heap after GC invocations=3 (full 1):
 PSYoungGen      total 38400K, used 0K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
  to   space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
}
Event: 7.434 GC heap before
{Heap before GC invocations=4 (full 2):
 PSYoungGen      total 38400K, used 0K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
  to   space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
Event: 7.446 GC heap after
Heap after GC invocations=4 (full 2):
 PSYoungGen      total 38400K, used 0K [0x00000000d5700000, 0x00000000d8180000, 0x0000000100000000)
  eden space 33280K, 0% used [0x00000000d5700000,0x00000000d5700000,0x00000000d7780000)
  from space 5120K, 0% used [0x00000000d7c80000,0x00000000d7c80000,0x00000000d8180000)
  to   space 5120K, 0% used [0x00000000d7780000,0x00000000d7780000,0x00000000d7c80000)
 ParOldGen       total 87552K, used 3786K [0x0000000080400000, 0x0000000085980000, 0x00000000d5700000)
  object space 87552K, 4% used [0x0000000080400000,0x00000000807b2ae0,0x0000000085980000)
 Metaspace       used 12859K, capacity 13104K, committed 13312K, reserved 1060864K
  class space    used 1651K, capacity 1723K, committed 1792K, reserved 1048576K
}

Deoptimization events (7 events):
Event: 0.283 Thread 0x00000000020cd000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002a1cad0 method=java.lang.String.hashCode()I @ 14
Event: 1.068 Thread 0x0000000059a2a000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002a6c90c method=java.lang.String.indexOf([CII[CIII)I @ 134
Event: 1.100 Thread 0x0000000059a2a000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002a5ed78 method=java.lang.String.startsWith(Ljava/lang/String;I)Z @ 25
Event: 13.820 Thread 0x0000000058ebc000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x0000000002d43894 method=java.util.regex.Pattern$Start.match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z @ 44
Event: 13.891 Thread 0x0000000058ebc000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x0000000002d43894 method=java.util.regex.Pattern$Start.match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z @ 44
Event: 13.892 Thread 0x0000000058ebc000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x0000000002d43894 method=java.util.regex.Pattern$Start.match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z @ 44
Event: 14.263 Thread 0x0000000058ebc000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002c722a8 method=java.util.HashMap.putVal(ILjava/lang/Object;Ljava/lang/Object;ZZ)Ljava/lang/Object; @ 94

Classes redefined (0 events):
No events

Internal exceptions (10 events):
Event: 0.540 Thread 0x00000000020cd000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000d5bc7d30) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 0.543 Thread 0x00000000020cd000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x00000000d5bd5080) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\methodHandles.cpp, line 1167]
Event: 0.747 Thread 0x0000000059a2a000 Exception <a 'java/io/FileNotFoundException'> (0x00000000d5db2a00) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 1.120 Thread 0x0000000059a2a000 Exception <a 'java/lang/NoClassDefFoundError'> (0x00000000d5e50c88) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1439]
Event: 12.374 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67aacd8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]
Event: 12.374 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67ac848) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]
Event: 12.374 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67ad968) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]
Event: 12.375 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67b2a88) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]
Event: 12.375 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67b36e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]
Event: 12.375 Thread 0x0000000058ebc000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d67b4308) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u181\11358\hotspot\src\share\vm\prims\jvm.cpp, line 1435]

Events (10 events):
Event: 14.261 loading class org/lwjgl/opengl/GL12 done
Event: 14.263 Thread 0x0000000058ebc000 Uncommon trap: trap_request=0xffffff65 fr.pc=0x0000000002c722a8
Event: 14.263 Thread 0x0000000058ebc000 DEOPT PACKING pc=0x0000000002c722a8 sp=0x000000005e60e6f0
Event: 14.263 Thread 0x0000000058ebc000 DEOPT UNPACKING pc=0x000000000295583b sp=0x000000005e60e660 mode 2
Event: 14.265 loading class com/jme3/texture/Texture$WrapAxis
Event: 14.265 loading class com/jme3/texture/Texture$WrapAxis done
Event: 14.265 loading class com/jme3/texture/Texture2D$1
Event: 14.265 loading class com/jme3/texture/Texture2D$1 done
Event: 14.274 loading class com/jme3/opencl/OpenCLObjectManager
Event: 14.274 loading class com/jme3/opencl/OpenCLObjectManager done

Dynamic libraries:
0x000000013f5b0000 - 0x000000013f5e7000     C:\Program Files\Java\jdk1.8.0_181\bin\java.exe
0x00000000779b0000 - 0x0000000077b4f000     C:\Windows\SYSTEM32\ntdll.dll
0x0000000077890000 - 0x00000000779af000     C:\Windows\system32\kernel32.dll
0x000007fefd790000 - 0x000007fefd7fa000     C:\Windows\system32\KERNELBASE.dll
0x000007feffb20000 - 0x000007feffbfb000     C:\Windows\system32\ADVAPI32.dll
0x000007feff300000 - 0x000007feff39f000     C:\Windows\system32\msvcrt.dll
0x000007fefdcc0000 - 0x000007fefdcdf000     C:\Windows\SYSTEM32\sechost.dll
0x000007fefd8c0000 - 0x000007fefd9ec000     C:\Windows\system32\RPCRT4.dll
0x0000000077790000 - 0x000000007788a000     C:\Windows\system32\USER32.dll
0x000007feff4b0000 - 0x000007feff517000     C:\Windows\system32\GDI32.dll
0x000007fefedf0000 - 0x000007fefedfe000     C:\Windows\system32\LPK.dll
0x000007fefeca0000 - 0x000007fefed6b000     C:\Windows\system32\USP10.dll
0x000007fefbc80000 - 0x000007fefbe75000     C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.24380_none_e3731d0b30fb6b11\COMCTL32.dll
0x000007fefed70000 - 0x000007fefede1000     C:\Windows\system32\SHLWAPI.dll
0x000007fefdc90000 - 0x000007fefdcbe000     C:\Windows\system32\IMM32.DLL
0x000007feff3a0000 - 0x000007feff4a9000     C:\Windows\system32\MSCTF.dll
0x00000000644f0000 - 0x00000000645c2000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\msvcr100.dll
0x00000000611c0000 - 0x0000000061a62000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\server\jvm.dll
0x000007fef6810000 - 0x000007fef6819000     C:\Windows\system32\WSOCK32.dll
0x000007fefdce0000 - 0x000007fefdd2d000     C:\Windows\system32\WS2_32.dll
0x000007feff520000 - 0x000007feff528000     C:\Windows\system32\NSI.dll
0x000007fefb750000 - 0x000007fefb78b000     C:\Windows\system32\WINMM.dll
0x000007fefc4c0000 - 0x000007fefc4cc000     C:\Windows\system32\VERSION.dll
0x0000000077b50000 - 0x0000000077b57000     C:\Windows\system32\PSAPI.DLL
0x0000000074530000 - 0x000000007453f000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\verify.dll
0x0000000074500000 - 0x0000000074529000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\java.dll
0x0000000069990000 - 0x00000000699a6000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\zip.dll
0x000007fefdd30000 - 0x000007fefeaba000     C:\Windows\system32\SHELL32.dll
0x000007fefd9f0000 - 0x000007fefdbef000     C:\Windows\system32\ole32.dll
0x000007fefd510000 - 0x000007fefd51f000     C:\Windows\system32\profapi.dll
0x0000000062180000 - 0x0000000062319000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\awt.dll
0x000007feffa40000 - 0x000007feffb1a000     C:\Windows\system32\OLEAUT32.dll
0x000007fefd3a0000 - 0x000007fefd3af000     C:\Windows\system32\CRYPTBASE.dll
0x000007fefbc00000 - 0x000007fefbc18000     C:\Windows\system32\DWMAPI.DLL
0x000007feef660000 - 0x000007feef77d000     C:\Windows\system32\opengl32.dll
0x000007fef7300000 - 0x000007fef732d000     C:\Windows\system32\GLU32.dll
0x000007fef4fa0000 - 0x000007fef5091000     C:\Windows\system32\DDRAW.dll
0x000007fefb170000 - 0x000007fefb178000     C:\Windows\system32\DCIMAN32.dll
0x000007fefeac0000 - 0x000007fefec97000     C:\Windows\system32\SETUPAPI.dll
0x000007fefd880000 - 0x000007fefd8b6000     C:\Windows\system32\CFGMGR32.dll
0x000007fefd6a0000 - 0x000007fefd6ba000     C:\Windows\system32\DEVOBJ.dll
0x000007fef3c20000 - 0x000007fef3e1f000     C:\Windows\system32\d3d9.dll
0x000007fef4a90000 - 0x000007fef4a97000     C:\Windows\system32\d3d8thk.dll
0x000007fed6f40000 - 0x000007fed8094000     C:\Windows\system32\nvd3dumx.dll
0x000007feec6f0000 - 0x000007feec8a7000     C:\Windows\system32\nvspcap64.dll
0x000007fef81d0000 - 0x000007fef8241000     C:\Windows\system32\WINHTTP.dll
0x000007fef8160000 - 0x000007fef81c5000     C:\Windows\system32\webio.dll
0x000007fef97a0000 - 0x000007fef9be2000     C:\Windows\system32\nvapi64.dll
0x000007fefd310000 - 0x000007fefd335000     C:\Windows\system32\SspiCli.dll
0x000007fefbb20000 - 0x000007fefbb4c000     C:\Windows\system32\powrprof.dll
0x000007feef780000 - 0x000007feef86b000     C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI64.dll
0x0000000064620000 - 0x0000000064667000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\fontmanager.dll
0x0000000068960000 - 0x000000006897a000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\net.dll
0x000007fefcc40000 - 0x000007fefcc95000     C:\Windows\system32\mswsock.dll
0x000007fefcc30000 - 0x000007fefcc37000     C:\Windows\System32\wship6.dll
0x0000000067c40000 - 0x0000000067c51000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\nio.dll
0x00000000645d0000 - 0x0000000064612000     C:\Program Files\Java\jdk1.8.0_181\jre\bin\t2k.dll
0x000007fee5810000 - 0x000007fee59e2000     S:\Git\jME master\jmonkeyengine\jme3-examples\bulletjme.dll
0x0000000180000000 - 0x0000000180064000     S:\Git\jME master\jmonkeyengine\jme3-examples\OpenAL64.dll
0x00000000585a0000 - 0x00000000585f3000     S:\Git\jME master\jmonkeyengine\jme3-examples\lwjgl64.dll
0x000000005eee0000 - 0x00000000611b8000     C:\Windows\system32\nvoglv64.DLL
0x000007fefc6b0000 - 0x000007fefc6c1000     C:\Windows\system32\WTSAPI32.dll
0x000007fefc530000 - 0x000007fefc533000     C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL
0x000007fefd820000 - 0x000007fefd85b000     C:\Windows\system32\WINTRUST.dll
0x000007fefd530000 - 0x000007fefd69d000     C:\Windows\system32\CRYPT32.dll
0x000007fefd500000 - 0x000007fefd50f000     C:\Windows\system32\MSASN1.dll
0x000007fefc310000 - 0x000007fefc33d000     C:\Windows\system32\ntmarta.dll
0x000007feff530000 - 0x000007feff582000     C:\Windows\system32\WLDAP32.dll
0x000007fef9480000 - 0x000007fef951c000     C:\Windows\system32\mscms.dll
0x000007fefd6c0000 - 0x000007fefd6de000     C:\Windows\system32\USERENV.dll
0x000007feef330000 - 0x000007feef372000     C:\Windows\system32\icm32.dll
0x000007fefcd80000 - 0x000007fefcdbd000     C:\Windows\system32\WINSTA.dll
0x000007feffc00000 - 0x000007feffc99000     C:\Windows\system32\CLBCatQ.DLL
0x000007fefbad0000 - 0x000007fefbb1b000     C:\Windows\System32\MMDevApi.dll
0x000007fefb9a0000 - 0x000007fefbacc000     C:\Windows\System32\PROPSYS.dll
0x000007fefb790000 - 0x000007fefb818000     C:\Windows\system32\dsound.dll
0x000007fefadf0000 - 0x000007fefae3f000     C:\Windows\system32\AUDIOSES.DLL
0x000007fef77e0000 - 0x000007fef7905000     C:\Windows\system32\dbghelp.dll

VM Arguments:
jvm_args: -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -ea 
java_command: jme3test.bullet.TestIssue1058
java_class_path (initial): S:\Git\jME master\jmonkeyengine\jme3-examples\build\classes\java\main;S:\Git\jME master\jmonkeyengine\jme3-examples\build\resources\main;S:\Git\jME master\jmonkeyengine\jme3-blender\build\libs\jme3-blender-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-jogl\build\libs\jme3-jogl-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-lwjgl\build\libs\jme3-lwjgl-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-desktop\build\libs\jme3-desktop-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-effects\build\libs\jme3-effects-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-bullet-native\build\libs\jme3-bullet-native-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-bullet\build\libs\jme3-bullet-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-jogg\build\libs\jme3-jogg-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-networking\build\libs\jme3-networking-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-niftygui\build\libs\jme3-niftygui-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-plugins\build\libs\jme3-plugins-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-terrain\build\libs\jme3-terrain-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-core\build\libs\jme3-core-3.3.0-SNAPSHOT.jar;S:\Git\jME master\jmonkeyengine\jme3-testdata\build\libs\jme3-testdata-3.3.0-SNAPSHOT.jar;C:\Users\Stephen\.gradle\caches\modules-2\files-2.1\org.ejml\simple\0.27\957fc40035f6a084304d64b28febcbe66c0994c7\simple-0.27.jar;C:\Users\Stephen\.gradle\caches\modules-2\files-2.1\org.ejml\dense64\0.27\ea70271f286016777ac079a5b33941d4e2b56d00\dense64-0.27.jar;C:\Users\Stephen\.gradle\caches\modules-2\files-2.1\org.ejml\denseC64\0.27\2529c9f8ffa12e15a1d7a21ad8d05f4a6cddfc0c\denseC64-0.27.jar;C:\Users\Stephen\.gradle\caches\modules-2\files-2.1\org.ejml\core\0.27\21d79552c6e103a850e82bfe3a5cb7294d1870b2\core-0.27.jar;C:\Users\Stephen\.gradle\caches\modules-2\files-2.1\de.jarnbjo\j-ogg-all\1.0.0\c74
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Skype\Phone\;C:\Windows\system32\gs\gs8.71\bin;C:\Program Files (x86)\Calibre2\;C:\Users\Stephen\AppData\Local\Programs\Microsoft VS Code\bin
USERNAME=Stephen
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel

---------------  S Y S T E M  ---------------

OS: Windows 7 , 64 bit Build 7601 (6.1.7601.24387)

CPU:total 4 (initial active 4) (4 cores per cpu, 1 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, tsc, tscinvbit

Memory: 4k page, physical 8368460k(4194652k free), swap 16735020k(12059104k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.181-b13) for windows-amd64 JRE (1.8.0_181-b13), built on Jul  7 2018 04:01:33 by "java_re" with MS VC++ 10.0 (VS2010)

time: Mon Apr 01 11:21:06 2019
elapsed time: 14 seconds (0d 0h 0m 14s)
stephengold commented 5 years ago

I got some help from @riccardobl . He was able to reproduce the issue on Linux, but the root cause is still a mystery. Unsure whether the bug is on the Bullet side or the JME side.

empirephoenix commented 5 years ago

This only happens with simple? what about the (parrallel whatever it was named) mode, does it has any influence?

stephengold commented 5 years ago

jme3-bullet has 2 options for threading (SEQUENTIAL and PARALLEL) and 4 options for broadphase collision detection (SIMPLE, AXIS_SWEEP_3, AXIS_SWEEP_3_32, and DBVT). The two sets of options are orthogonal.

This issue happens only with SIMPLE broadphase. It happens with both SEQUENTIAL and PARALLEL threading.

stephengold commented 5 years ago

In btSimpleBroadphase::destroyProxy(), Bullet calls freeHandle() on the proxy before passing it to btOverlappingPairCache::removeOverlappingPairsContainingProxy(). I'm a bit rusty on C++, but that looks like a bug to me...

stephengold commented 5 years ago

Re-ordering those 2 statements seems to resolve this issue. I'll submit a pull request to the Bullet Physics SDK project.

stephengold commented 5 years ago

https://github.com/bulletphysics/bullet3/pull/2180

stephengold commented 5 years ago

My PR got integrated. The next release of Bullet should include the fix.

stephengold commented 4 years ago

Bullet 2.89 was released in December 2019; it should contain the fix. I'll run some tests and upgrade jme3-bullet-native and jme3-bullet-native-android if appropriate.

stephengold commented 4 years ago

The test case above passes on current master branch. I hadn't realized it, but jme3-bullet-native is using an unreleased build of Bullet (from 15 November 2019) that includes the fix. It appears this issue was fixed by PR #1216, so it can now be closed.