Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Espresso java.lang.VerifyError: Wrong local map frames in class file #3261

Closed
florensie opened this issue Mar 7, 2021 · 12 comments
Closed
Assignees
Labels

Comments

@florensie
Copy link

florensie commented Mar 7, 2021

Describe GraalVM and your environment :

  • GraalVM version or commit id if built from source: 21.0.0.2
  • CE or EE: CE
  • JDK version: JDK8
  • OS and OS Version: Arch Linux
  • Architecture: amd64
  • The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (25.282-b07-jvmci-21.0-b06) for linux-amd64 JRE (1.8.0), built on Jan 12 2021 02:07:56 by "buildslave" with gcc 7.3.0

Have you verified this issue still happens when using the latest snapshot?
Yes, the same issue occurs on GraalVM CE 21.1.0-dev

Describe the issue
An error while starting Minecraft versions 1.13.2 and above using Espresso (-truffle VM option)

java.lang.VerifyError: Wrong local map frames in class file: Klass<Lnet/minecraft/world/phys/shapes/Shapes;>.findBits

Code snippet or code repository that reproduces the issue
Here is a repo using the Fabric modding toolchain for Minecraft 1.16.5. The necessary IDE run configurations are created automatically including -truffle -XX:+IgnoreUnrecognizedVMOptions.
https://github.com/florensie/espressotest

Steps to reproduce the issue

  1. Clone the above mentioned repo
  2. (Optional, eclipse/vscode only) Generate the run configurations for your IDE using gradlew eclipse or gradlew vscode
  3. Run the generated run configuration Minecraft Client or Minecraft Server or run gradlew runClient or gradlew runServer

Expected behavior
The game starts without any errors. This

Additional context

Details
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:228)
	at net.fabricmc.loader.launch.knot.Knot.launch(Knot.java:146)
	at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:28)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:226)
	... 3 more
Caused by: java.lang.VerifyError: Wrong local map frames in class file: Klass<Lnet/minecraft/world/phys/shapes/Shapes;>.findBits
	at net.minecraft.world.level.block.Block.box(Block.java:115)
	at net.minecraft.world.level.block.SaplingBlock.<clinit>(SaplingBlock.java:66)
	at net.minecraft.world.level.block.Blocks.<clinit>(Blocks.java:901)
	at net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilder.<clinit>(SurfaceBuilder.java:87)
	at net.minecraft.data.worldgen.SurfaceBuilders.<clinit>(SurfaceBuilders.java:40)
	at net.minecraft.data.BuiltinRegistries.lambda$static$0(BuiltinRegistries.java:76)
	at net.minecraft.data.BuiltinRegistries.lambda$static$6(BuiltinRegistries.java:97)
	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
	at net.minecraft.data.BuiltinRegistries.<clinit>(BuiltinRegistries.java:96)
	at net.minecraft.core.Registry.<clinit>(Registry.java:548)
	at net.minecraft.server.Bootstrap.bootStrap(Bootstrap.java:37)
	at net.minecraft.client.main.Main.main(Main.java:121)
	... 8 more
@mukel mukel self-assigned this Mar 7, 2021
@mukel mukel added bug java on truffle Espresso and removed truffle labels Mar 7, 2021
@mukel
Copy link
Member

mukel commented Mar 7, 2021

I've tried older versions of Minecraft, before it was bundled with the launcher. You can use -Xverify:none to disable the verifier (not recommended) and also speedup compilation with --java.InlineFieldAccessors --engine.Inlining=false.

@florensie
Copy link
Author

Not sure if it's at all related but disabling the verifier results in this very long stacktrace: https://gist.github.com/florensie/24e4ff01364db583938d75d26589f1d7

@mukel
Copy link
Member

mukel commented Mar 9, 2021

LWJGL violates the JVM spec here and here. Scanning objects like that is illegal. Field offsets are just a token/cookie, the physical location of a field remains an implementation detail.
I'm working on a patch for LWJGL to use JNI to compute the offsets in a spec-compliant way.

@mukel
Copy link
Member

mukel commented Mar 14, 2021

Verifier issue was fixed in cd82245 . PR/discussion for the unsafe scan here.

@mukel
Copy link
Member

mukel commented Mar 15, 2021

LWJGL tip is now spec-compliant. Minecraft should work now but sadly I cannot test a different LWJGL version using your setup (Fabric Loom).

@florensie
Copy link
Author

Thanks for making it happen! I'll see if I can't find a way to test it out with Minecraft again, I'll close the issue until then and report back if I manage to figure it out.

@florensie
Copy link
Author

florensie commented Mar 19, 2021

I added the latest LWJGL version to my testing environment (https://github.com/florensie/espressotest).

[13:19:49] [main/INFO] (Minecraft) Backend library: LWJGL version 3.3.0 build 9

However, the verifier still gets hung up at the same spot. Disabling the verifier with -Xverify:none again seems to work until a segmentation fault occurs much later during launch.

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Running the server does seem to work now. It just has some warnings and it tries to shut itself down (and fails at that) because it's too slow. Took about 20 minutes to fully finish loading for me.

@florensie florensie reopened this Mar 19, 2021
@mukel
Copy link
Member

mukel commented Mar 19, 2021

I tried a fresh GraalVM (build from sources) and the issues with Espresso are fixed.
Fixes will go live with GraalVM 21.1 , in the meantime you can find GraalVM dev builds in https://github.com/graalvm/graalvm-ce-dev-builds/releases (I don't think they contain the Espresso patch yet).

Minecraft 1.16.5 is not compatible out-of-the-box with LWJGL >= 3.3.0, vanilla HotSpot crashes the same way.
Stacktrace for reference:

[14:46:49] [main/INFO] (Minecraft) Reloading ResourceManager: Default
FATAL ERROR in native method: Thread[Render thread,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
        at org.lwjgl.opengl.GL11.glEnableClientState(Native Method)
        at com.mojang.blaze3d.platform.GlStateManager._enableClientState(GlStateManager.java:1513)
        at com.mojang.blaze3d.vertex.VertexFormatElement$Usage.lambda$static$0(VertexFormatElement.java:110)
        at com.mojang.blaze3d.vertex.VertexFormatElement$Usage$$Lambda$2740/0x0000000840aae040.setupBufferState(Unknown Source)
        at com.mojang.blaze3d.vertex.VertexFormatElement$Usage.setupBufferState(VertexFormatElement.java:154)
        at com.mojang.blaze3d.vertex.VertexFormatElement$Usage.access$000(VertexFormatElement.java:107)
        at com.mojang.blaze3d.vertex.VertexFormatElement.setupBufferState(VertexFormatElement.java:100)
        at com.mojang.blaze3d.vertex.VertexFormat.setupBufferState(VertexFormat.java:76)
        at com.mojang.blaze3d.vertex.BufferUploader._end(BufferUploader.java:45)
        at com.mojang.blaze3d.vertex.BufferUploader.end(BufferUploader.java:24)
        at net.minecraft.client.gui.GuiComponent.innerFill(GuiComponent.java:72)
        at net.minecraft.client.gui.GuiComponent.fill(GuiComponent.java:44)
        at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:88)
        at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:605)
        at net.minecraft.client.Minecraft.runTick(Minecraft.java:1048)
        at net.minecraft.client.Minecraft.run(Minecraft.java:681)
        at net.minecraft.client.main.Main.main(Main.java:215)
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11.0.11/Native Method)
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11.0.11/NativeMethodAccessorImpl.java:62)
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.11/DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(java.base@11.0.11/Method.java:566)
        at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:226)
        at net.fabricmc.loader.launch.knot.Knot.launch(Knot.java:146)
        at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:28)
        at java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.base@11.0.11/DirectMethodHandle$Holder)
        at java.lang.invoke.LambdaForm$MH/0x0000000840067440.invokeExact_MT(java.base@11.0.11/LambdaForm$MH)
        at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

@florensie
Copy link
Author

florensie commented Mar 19, 2021

Minecraft 1.16.5 is not compatible out-of-the-box with LWJGL

Yeah I didn't consider that. It seems to work fine for me at least on hotspot 15 but it might be down to the natives/platform. I'll give it a go when another dev build goes live.

@mukel
Copy link
Member

mukel commented Mar 19, 2021

It fails for me on vanilla OpenJDK 8, 11 and 15. I'm on Linux (Arch-based distro).

@florensie
Copy link
Author

Weird, it worked for me on arch with the jdk-openjdk package.

@mukel
Copy link
Member

mukel commented Mar 19, 2021

I'm probably hitting something similar to this: LWJGL/lwjgl3#602
My laptop integrated GPU (Intel 620) doesn't support GL_NV_vertex_buffer_unified_memory, not sure if glEnableClientState exists but it seems not.
Do you have it when you run glinfo?
I also tried on my desktop computer (fanless AMD video card) and I got the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants