Hey
I’ve tried searching here and otherwise google’in, but came up short. I get this in my logs alot:
Aug 04, 2020 11:27:12 PM com.jme3.util.ReflectionAllocator destroyDirectBuffer
SEVERE: Buffer cannot be destroyed: java.nio.DirectByteBuffer[pos=0 lim=48 cap=48]
I’ve tried switching to LWJGL3 in gradle build like so:
implementation "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
wih jmeVersion being 3.4.0
and I have tried adding
add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED"
to the
applicationDefaultJvmArgs = ["-Xmx1024m", "-Xms512m", "-XX:MaxDirectMemorySize=1024m","--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED"]
I have also tried dispose()
after calling in images for use in textures (not sure if that even makes sense to do, but I got that hint in another thread discussing the same messages).
My java versions are as follows:
java --version
openjdk 14.0.2 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)
and
javac --version
javac 14.0.2
am I missing anything or any know work arounds I can try?
1 Like
sgold
August 5, 2020, 2:42am
2
I’m curious what code is invoking destroyDirectBuffer()
. Could you set a breakpoint using the debugger and print a stack trace?
Ali_RS
August 5, 2020, 6:01am
3
asser_fahrenholz:
to the
applicationDefaultJvmArgs = [
"-Xmx1024m", "-Xms512m", "-XX:MaxDirectMemorySize=1024m",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED"]
I think --add-opens
and java.base/jdk.internal.ref=ALL-UNNAMED
are not separated things.
They should be single argument as below:
"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED"
For understanding why that error happens please see here:
opened 08:11AM - 21 Apr 20 UTC
closed 03:37PM - 10 Oct 20 UTC
Testing 3.3.1 release candidate, although it isn't a regression. I encounter the… same issues on 3.2.4-stable.
When running this example with JDK8:
```
Apr 21, 2020 10:09:02 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.0-SNAPSHOT
* Branch: v3.3
* Git Hash: a150deb
* Build Date: 2020-04-21
Apr 21, 2020 10:09:02 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
* Graphics Adapter: null
* Driver Version: null
* Scaling Factor: 1
Apr 21, 2020 10:09:02 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NoSuchMethodError: java.nio.IntBuffer.clear()Ljava/nio/IntBuffer;
at com.jme3.util.BufferUtils.createIntBuffer(BufferUtils.java:927)
at com.jme3.renderer.lwjgl.LwjglGL.<init>(LwjglGL.java:15)
at com.jme3.system.lwjgl.LwjglContext.initContextFirstTime(LwjglContext.java:257)
at com.jme3.system.lwjgl.LwjglContext.internalCreate(LwjglContext.java:424)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:117)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:213)
at java.lang.Thread.run(Thread.java:748)
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread "jME3 Main"
```
When running on JDK11:
```
Apr 21, 2020 10:10:38 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.0-SNAPSHOT
* Branch: v3.3
* Git Hash: a150deb
* Build Date: 2020-04-21
Apr 21, 2020 10:10:38 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
* Graphics Adapter: null
* Driver Version: null
* Scaling Factor: 1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/Users/remy/Projects/jMonkeyEngine/jmonkeyengine/jme3-core/build/libs/jme3-core-3.3.0-SNAPSHOT.jar) to method sun.nio.ch.DirectBuffer.cleaner()
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
Apr 21, 2020 10:10:38 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: ATI Technologies Inc.
* Renderer: AMD Radeon Pro Vega 20 OpenGL Engine
* OpenGL Version: 2.1 ATI-2.11.21
* GLSL Version: 1.20
* Profile: Compatibility
Apr 21, 2020 10:10:39 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
* Device: MacBook Pro Speakers
* Vendor: Apple Computer Inc.
* Renderer: Software
* Version: 1.1
* Supported channels: 64
* ALC extensions: ALC_EXT_CAPTURE ALC_ENUMERATION_EXT ALC_EXT_MAC_OSX ALC_EXT_ASA ALC_EXT_ASA_DISTORTION ALC_EXT_ASA_ROGER_BEEP
* AL extensions: AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE AL_EXT_float32 AL_EXT_STATIC_BUFFER AL_EXT_SOURCE_NOTIFICATIONS AL_EXT_SOURCE_SPATIALIZATION
Apr 21, 2020 10:10:39 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Apr 21, 2020 10:10:39 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: OpenAL EFX not available! Audio effects won't work.
Apr 21, 2020 10:10:39 AM com.jme3.util.ReflectionAllocator destroyDirectBuffer
SEVERE: Buffer cannot be destroyed: java.nio.DirectByteBuffer[pos=0 lim=500000 cap=500000]
Apr 21, 2020 10:10:39 AM com.jme3.util.ReflectionAllocator destroyDirectBuffer
```
Edit:
Note, this error wont happen with jme3-lwjgl3
as it does not use ReflectionAllocator
.
1 Like
Ali_RS:
jme3-lwjgl3
So, am I doing something wrong in trying to use lwjgl3 - or I have something else entirely invoking ReflectionAllocator (even though I dont really use reflection directly)
I dont have the source for jme3 set up (I’m just adding the dependencies through gradle), but I’ll try doing that and getting a breakpoint set to dive deeper into this.
1 Like
Ali_RS
August 5, 2020, 7:46am
6
I do not know.
have you tried this as I explained?
Yes, the warning is still there
Trying to add jme3 project (from Github) as dependency:
implementation project(":jme3-core")
//implementation "org.jmonkeyengine:jme3-core:$jmeVersion"
I get
FAILURE: Build failed with an exception.
What went wrong:
Circular dependency between the following tasks:
:jme3-core:classes
±-- :jme3-core:compileGroovy
| ±-- :jme3-core:compileJava
| | -– :jme3-core:jar
| | -– :jme3-core:classes ()
| -– :jme3-core:jar ( )
-– :jme3-core:compileJava (*)
(*) - details omitted (listed previously)
I’m probably missing something really basic about Gradle and sources/projects.
Anyone have a link to a guide I can read on how to set up the dependencies so I can debug them ?
Ali_RS
August 5, 2020, 8:05am
9
Also, it will print which LWJGL version you are using into the console when you start the app.
For LWJGL2 you should see this:
12:25:00,344 INFO [LwjglContext] LWJGL 2.9.3 context running on thread jME3 Main
and for LWJGL3
12:33:32,148 INFO [LwjglContext] LWJGL 3.2.3 build 13 context running on thread main`
1 Like
This is written in the log when starting the app:
Aug 05, 2020 10:12:24 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.2.3 build 13 context running on thread main
At the very start, I do see this though (not sure its related)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:…/jmonkeyengine/jme3-core/3.4.0-SNAPSHOT/jme3-core-3.4.0-SNAPSHOT.jar) to method sun.nio.ch.DirectBuffer.cleaner()
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
Ali_RS
August 5, 2020, 8:40am
11
Can you add this into your main method and show us the result?
// get a RuntimeMXBean reference
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
// get the jvm's input arguments as a list of strings
List<String> listOfArguments = runtimeMxBean.getInputArguments();
listOfArguments.forEach(s -> System.out.println("ARG:" + s));
Here’s the output:
ARG:-XX:MaxDirectMemorySize=1024m
ARG:–add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
ARG:-Xms512m
ARG:-Xmx1024m
ARG:-Dfile.encoding=windows-1252
ARG:-Duser.country=GB
ARG:-Duser.language=en
ARG:-Duser.variant
Should the line only have 1 dash perhaps? …
Ali_RS
August 5, 2020, 10:33am
13
Wait…
?
it should be --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
note the jdk.internal.loader
vs jdk.internal.ref
1 Like
Thank you. That got rid of all the SEVERE warnings. Does that mean its solved or does this just “hide the problem” ?
So my original problem was solved by both LWJGL3 and the JVM args. Thank you both for chipping in.
2 Likes
Ali_RS
August 5, 2020, 10:42am
17
I mean by setting this JVM arg you can keep using LWJGL2 if that is what you want.
Edit:
Marked the thread solved.
2 Likes