stephengold / Minie

Integrate Bullet Physics and V-HACD into jMonkeyEngine projects (code has New BSD license)
https://stephengold.github.io/Minie/minie/overview.html
Other
122 stars 22 forks source link

TestCloneBody crashes Java 14 JVM on Windows #9

Closed stephengold closed 4 years ago

stephengold commented 4 years ago

So far, seen only at GitHub actions:

  1. https://github.com/stephengold/Minie/runs/861771383 for commit hash a10d577:
    jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
    Debug_Libbulletjme version 8.4.0 initializing
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffdfcfac458, pid=5012, tid=6656
    #
    WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    # JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
    # Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
    # Problematic frame:
    # C  [bulletjme.dll+0x13c458]
    #
    # Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid5012.mdmp
    #
    # An error report file with more information is saved as:
    # D:\a\Minie\Minie\MinieLibrary\hs_err_pid5012.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://www.azulsystems.com/support/
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
    Terminate batch job (Y/N)? 
    ##[error]The operation was canceled.

The job was cancelled after 6 hours of runtime(!) No artifacts were generated.

  1. https://github.com/stephengold/Minie/runs/848041937 for commit hash 57bc126:
    
    jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
    Debug_Libbulletjme version 8.3.0 initializing
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/runneradmin/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.3.2-stable/9268edf0d6ff46f44d7ce8cb3653e20f89719832/jme3-core-3.3.2-stable.jar) to method sun.nio.ch.DirectBuffer.cleaner()
    #
    # A fatal error has been detected by the Java Runtime Environment:
    WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
    #
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffa596cc238, pid=3436, tid=6324
    WARNING: All illegal access operations will be denied in a future release
    #
    # JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
    # Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
    # Problematic frame:
    # C  [bulletjme.dll+0x13c238]
    #
    # Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid3436.mdmp
    #
    # An error report file with more information is saved as:
    # D:\a\Minie\Minie\MinieLibrary\hs_err_pid3436.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://www.azulsystems.com/support/
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
    Unexpected exception thrown.

org.gradle.internal.remote.internal.MessageIOException: Could not write '/127.0.0.1:50233'.


The crash log was recovered. Here is the stack:
```text
Current thread (0x000001ac1e8b8800):  JavaThread "Physics Cleaner" daemon [_thread_in_native, id=6324, stack(0x000000a22c900000,0x000000a22ca00000)]

Stack: [0x000000a22c900000,0x000000a22ca00000],  sp=0x000000a22c9fe920,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [bulletjme.dll+0x13c238]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.jme3.bullet.collision.PhysicsCollisionObject.finalizeNative(J)V+0
j  com.jme3.bullet.collision.PhysicsCollisionObject.freeNativeObject(J)V+21
v  ~StubRoutines::call_stub
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.1
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.1
j  jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.1
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.1
j  com.jme3.bullet.NpoTracker.freeTrackedObject()V+71
j  com.jme3.bullet.NativePhysicsObject.freeUnusedObjects()V+11
j  com.jme3.bullet.util.NativeLibrary$1.run()V+0
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffffffffff
  1. https://github.com/stephengold/Minie/runs/814307022 for commit hash 9aa2249
    
    jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
    WARNING: All illegal access operations will be denied in a future release
    Debug_Libbulletjme version 8.2.0 initializing
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd41b9bde8, pid=1260, tid=356
    #
    # JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
    # Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
    # Problematic frame:
    # C  [bulletjme.dll+0x13bde8]
    #
    # Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid1260.mdmp
    #
    # An error report file with more information is saved as:
    # D:\a\Minie\Minie\MinieLibrary\hs_err_pid1260.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://www.azulsystems.com/support/
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #


No artifacts were generated.
stephengold commented 4 years ago

I modified TestCloneBody to iterate 99 times over all its test cases. Now I see a similar crash in my desktop Linux environment.

stephengold commented 4 years ago

The essence of this issue: finalizeNative() methods should be invoked ONLY from freeNativeObject() methods.

stephengold commented 4 years ago

Fixed in master branch at 2d84a4e.