dacapobench / dacapobench

The DaCapo benchmark suite

Home Page:https://www.dacapobench.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RC5: jme hangs with a tight heap

caizixian opened this issue · comments

/usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xms27M -Xmx27M -server -XX:+UseCompressedOops -XX:+ExitOnOutOfMemoryError -XX:+UseG1GC -Xlog:exceptions -XX:+DisableExplicitGC -jar /usr/share/benchmarks/dacapo/dacapo-23.10-RC5-chopin.jar jme -t 1

Log
jme.log

An example is the following.

[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in C1 compiled method <{method} {0x00007f28a31c5780} 'reserveMemory' '(JJ)V' in 'java/nio/Bits'>
 at PC0x00007f2904c2b324 for thread 0x00007f2848031b20
[1.236s][info][exceptions  ] Found catch-all handler for exception of type "java.lang.OutOfMemoryError" in method "reserveMemory" at BCI: 216
[1.236s][info][exceptions  ] Thread 0x00007f2848031b20 continuing at PC 0x00007f2904c2b88f for exception thrown at PC 0x00007f2904c2b324
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in C1 compiled method <{method} {0x00007f28a31c2258} '<init>' '(I)V' in 'java/nio/DirectByteBuffer'>
 at PC0x00007f2904c2cc5c for thread 0x00007f2848031b20
[1.236s][info][exceptions  ] Thread 0x00007f2848031b20 continuing at PC 0x00007f2904c2d875 for exception thrown at PC 0x00007f2904c2cc5c
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in C1 compiled method <{method} {0x00007f289f9d4b40} 'readRGB2D' '(ZI)Ljava/nio/ByteBuffer;' in 'com/jme3/texture/plugins/DDSLoader'>
 at PC0x00007f2904c512d4 for thread 0x00007f2848031b20
[1.236s][info][exceptions  ] Thread 0x00007f2848031b20 continuing at PC 0x00007f2904c522a9 for exception thrown at PC 0x00007f2904c512d4
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9d5890} 'readData' '(Z)Ljava/util/ArrayList;' in 'com/jme3/texture/plugins/DDSLoader'>
 at bci 109 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9d3620} 'load' '(Lcom/jme3/asset/AssetInfo;)Ljava/lang/Object;' in 'com/jme3/texture/plugins/DDSLoader'>
 at bci 89 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Found matching handler for exception of type "java.lang.OutOfMemoryError" in method "load" at BCI: 163
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9d3620} 'load' '(Lcom/jme3/asset/AssetInfo;)Ljava/lang/Object;' in 'com/jme3/texture/plugins/DDSLoader'>
 at bci 171 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Found catch-all handler for exception of type "java.lang.OutOfMemoryError" in method "load" at BCI: 172
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9d3620} 'load' '(Lcom/jme3/asset/AssetInfo;)Ljava/lang/Object;' in 'com/jme3/texture/plugins/DDSLoader'>
 at bci 208 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9a6318} 'loadLocatedAsset' '(Lcom/jme3/asset/AssetKey;Lcom/jme3/asset/AssetInfo;Lcom/jme3/asset/AssetProcessor;Lcom/jme3/asset/cache/AssetCache;)Ljava/lang/Object;' in 'com/jme3/asset/DesktopAssetManager'>
 at bci 21 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Found catch-all handler for exception of type "java.lang.OutOfMemoryError" in method "loadLocatedAsset" at BCI: 70
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9a6318} 'loadLocatedAsset' '(Lcom/jme3/asset/AssetKey;Lcom/jme3/asset/AssetInfo;Lcom/jme3/asset/AssetProcessor;Lcom/jme3/asset/cache/AssetCache;)Ljava/lang/Object;' in 'com/jme3/asset/DesktopAssetManager'>
 at bci 82 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9a67e8} 'loadAsset' '(Lcom/jme3/asset/AssetKey;)Ljava/lang/Object;' in 'com/jme3/asset/DesktopAssetManager'>
 at bci 189 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f9a69a0} 'loadTexture' '(Lcom/jme3/asset/TextureKey;)Lcom/jme3/texture/Texture;' in 'com/jme3/asset/DesktopAssetManager'>
 at bci 2 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289fac9ae0} 'createSky' '(Lcom/jme3/asset/AssetManager;Ljava/lang/String;Lcom/jme3/util/SkyFactory$EnvMapType;)Lcom/jme3/scene/Spatial;' in 'com/jme3/util/SkyFactory'>
 at bci 31 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f8f73c0} 'simpleInitApp' '()V' in 'jme3test/water/TestMultiPostWater'>
 at bci 140 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f4ce190} 'initialize' '()V' in 'com/jme3/app/SimpleApplication'>
 at bci 282 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f993eb0} 'initInThread' '()V' in 'com/jme3/system/NullContext'>
 at bci 106 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f289f994230} 'run' '()V' in 'com/jme3/system/NullContext'>
 at bci 1 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f28a34355b0} 'runWith' '(Ljava/lang/Object;Ljava/lang/Runnable;)V' in 'java/lang/Thread'>
 at bci 5 for thread 0x00007f2848031b20 (jME3 Headless Main)
[1.236s][info][exceptions  ] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ff8585e8}: Cannot reserve 262144 bytes of direct buffer memory (allocated: 29310240, limit: 29360128)>
 thrown in interpreter method <{method} {0x00007f28a3017600} 'run' '()V' in 'java/lang/Thread'>
 at bci 19 for thread 0x00007f2848031b20 (jME3 Headless Main)

jme uses nio for byte buffer, and the OutOfMemoryError is thrown by the Java standard library instead of HotSpot, so ExitOnOutOfMemoryError doesn't cover this scenario.

This behavior has been extensively discussed in the OpenJDK community.
https://bugs.openjdk.org/browse/JDK-8257790
https://bugs.openjdk.org/browse/JDK-8294052
https://mail.openjdk.org/pipermail/nio-dev/2022-September/012117.html
openjdk/jdk#16176

Thanks.

Fixed in c180c24

This fix was incomplete. For example, with a heap of 24M, it fails here.

[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in C1 compiled method <{method} {0x00007fe0033add60} 'reserveMemory' '(JJ)V' in 'java/nio/Bits'>
 at PC0x00007fe0617257f4 for thread 0x00007fdfb0027e20
[1.318s][info][exceptions] Found catch-all handler for exception of type "java.lang.OutOfMemoryError" in method "reserveMemory" at BCI: 216
[1.318s][info][exceptions] Thread 0x00007fdfb0027e20 continuing at PC 0x00007fe061725d8d for exception thrown at PC 0x00007fe0617257f4
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in C1 compiled method <{method} {0x00007fe0033afbf8} '<init>' '(I)V' in 'java/nio/DirectByteBuffer'>
 at PC0x00007fe061727224 for thread 0x00007fdfb0027e20
[1.318s][info][exceptions] Thread 0x00007fdfb0027e20 continuing at PC 0x00007fe061727dd7 for exception thrown at PC 0x00007fe061727224
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in C1 compiled method <{method} {0x00007fe0485949e8} 'createFloatBuffer' '(I)Ljava/nio/FloatBuffer;' in 'com/jme3/util/BufferUtils'>
 at PC0x00007fe0617299e4 for thread 0x00007fdfb0027e20
[1.318s][info][exceptions] Thread 0x00007fdfb0027e20 continuing at PC 0x00007fe061729da2 for exception thrown at PC 0x00007fe0617299e4
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe048a71550} 'createMesh' '(Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector2f;Lcom/jme3/math/Vector2f;FIZIZZZZ)Lcom/jme3/scene/Mesh;' in 'com/jme3/terrain/geomipmap/LODGeomap'>
 at bci 76 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe048a712b0} 'createMesh' '(Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector2f;Lcom/jme3/math/Vector2f;FIZ)Lcom/jme3/scene/Mesh;' in 'com/jme3/terrain/geomipmap/LODGeomap'>
 at bci 15 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe048a60438} '<init>' '(Ljava/lang/String;ILcom/jme3/math/Vector3f;[FLcom/jme3/math/Vector3f;ILcom/jme3/math/Vector2f;F)V' in 'com/jme3/terrain/geomipmap/TerrainPatch'>
 at bci 106 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854c4f8} 'createQuadPatch' '([F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 191 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854be38} 'split' '(I[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 14 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854b018} '<init>' '(Ljava/lang/String;IILcom/jme3/math/Vector3f;[FILcom/jme3/math/Vector2f;F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 156 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854bea0} 'createQuad' '(I[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 357 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854be38} 'split' '(I[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 23 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854b018} '<init>' '(Ljava/lang/String;IILcom/jme3/math/Vector3f;[FILcom/jme3/math/Vector2f;F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 156 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854bea0} 'createQuad' '(I[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 715 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854be38} 'split' '(I[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 23 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854b018} '<init>' '(Ljava/lang/String;IILcom/jme3/math/Vector3f;[FILcom/jme3/math/Vector2f;F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 156 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854ae98} '<init>' '(Ljava/lang/String;IILcom/jme3/math/Vector3f;[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 17 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04854ada0} '<init>' '(Ljava/lang/String;II[F)V' in 'com/jme3/terrain/geomipmap/TerrainQuad'>
 at bci 9 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe048607260} 'createTerrain' '(Lcom/jme3/scene/Node;)V' in 'jme3test/water/TestMultiPostWater'>
 at bci 305 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe048606f68} 'simpleInitApp' '()V' in 'jme3test/water/TestMultiPostWater'>
 at bci 29 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe0484c5b68} 'initialize' '()V' in 'com/jme3/app/SimpleApplication'>
 at bci 282 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04895ba40} 'initInThread' '()V' in 'com/jme3/system/NullContext'>
 at bci 106 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe04895bda8} 'run' '()V' in 'com/jme3/system/NullContext'>
 at bci 1 for thread 0x00007fdfb0027e20 (jME3 Headless Main)
[1.318s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00000000ffcf5640}: Cannot reserve 50700 bytes of direct buffer memory (allocated: 25160791, limit: 25165824)>
 thrown in interpreter method <{method} {0x00007fe00301cf38} 'run' '()V' in 'java/lang/Thread'>
 at bci 11 for thread 0x00007fdfb0027e20 (jME3 Headless Main)

I have addressed (almost) all remaining cases in 266e887. I've tested on all heap sizes < 28M and with 8, 11, 17 and 21 JDKs.

The only case remaining I'm aware of is JDK 11 and 8 on 6M heap.

jvm=11.0.20-tem; h=6M; /usr/<...>/java/$jvm/bin/java -Xms$h -Xmx$h -jar dacapo-evaluation-git-266e887.jar jme

Unfortunately when the -Xlog:exceptions flag is added, its behavior changes and it dies gracefully.