iPortalTeam / ImmersivePortalsMod

Non-Euclidean in Minecraft. See through portals and teleport seamlessly.
https://qouteall.fun/immptl/
Apache License 2.0
452 stars 113 forks source link

Crash With GraalVM #1153

Closed brucethemoose closed 2 years ago

brucethemoose commented 2 years ago

According to your testing, does the issue occur with ONLY Immersive Portals mod and Farbic API?

Yes

Describe the issue

The game crashes after hitting the "singleplayer" button, during the "preparing for world creation" phase, when running the GraalVM Enterprise Edition Java VM, with no non-default arguments.

Log: https://mclo.gs/azus7sJ

This version of Java can be downloaded here, after registering an email: https://www.oracle.com/downloads/graalvm-downloads.html

Other versions of Java, including GraalVM Community Edition, do not crash on this setup: https://mclo.gs/oXbXJoO

This is a partial continuation of this issue: https://github.com/brucethemoose/Minecraft-Java-Performance-Flags/issues/6

And yeah, this is a weird one... let me know if y'all need any more information or testing done.

qouteall commented 2 years ago

You mean that in some setup immptl works with GraalVM and in come setup immptl does not work?

So what's the difference between the two setups?

qouteall commented 2 years ago

If the Oracle Java crashes and GraalVM Community Java does not crash, it's probably a bug of the Oracle Java

brucethemoose commented 2 years ago

If the Oracle Java crashes and GraalVM Community Java does not crash, it's probably a bug of the Oracle Java

Perhaps, but GraalVM EE runs without issue with the vast majority of mods I've tried, so this crash is a bit odd.

I'm going to see if it crashes the 1.18 version of immptl as well, and try disabling some stuff in EE to see if that helps.

qouteall commented 2 years ago

The crashed log says:

Checking Java version...
28 | Java is version 17.0.4, using 64 (amd64) architecture, from Oracle Corporation.

The not crashed log says:

Checking Java version...
28 | Java is version 17.0.4, using 64 (amd64) architecture, from GraalVM Community.

So the issue is with the Oracle Java, not the Graal Java

brucethemoose commented 2 years ago

If the Oracle Java crashes and GraalVM Community Java does not crash, it's probably a bug of the Oracle Java

Perhaps, but GraalVM EE runs without issue with the vast majority of mods I've tried, so this crash is a bit odd.

I'm going to see if it crashes the 1.18 version of immptl as well, and try disabling some stuff in EE to see if that helps.

Yes, Oracle GraalVM Enterprise Edition is the Java that crashes, GraalVM Community Edtion (which I think is still managed by Oracle?) does not crash. No other version of Java I tried crashes other than GraalVM EE.

And to be clear, the reason I'm interested in this at all is that GraalVM Enterprise Edition has some performance optimizations over the Community Editions and other OpenJDK builds. So far, this is the only mod I've found that's incompatible.

brucethemoose commented 2 years ago

Here is a crash with the 1.18.2 version of Immersive Portals and GraalVM EE.

https://mclo.gs/f3iATRd

Looks like a similar error.

qouteall commented 2 years ago

It's probably a bug of Oracle GraalVM Enterprise Edition. It's out of immpt's scope and I am not going to debug it unfortunately.

brucethemoose commented 2 years ago

Hmmm, alright, well thanks for taking a look.

For what it's worth, adding the flags -XX:-UseJVMCICompiler -Dgraal.CompilerConfiguration=community fixes the crash. So it looks like the enterprise compiler is indeed the issue, as documented here: https://www.graalvm.org/22.1/reference-manual/java/options/

I'll see if disabling any of the more specific optimizations fixes this crash... but this will take some time.

brucethemoose commented 2 years ago

I narrowed this down. It doesn't crash in GraalVM 22.1.0, and it doesn't crash in the current release (22.2.0) with the -Dgraal.UsePriorityInlining=false parameter.

From the Oracle site: -Dgraal.UsePriorityInlining=true: This can be used to disable use of the advanced inlining algorithm that favours throughput over compilation speed.

So... its an inlining issue? Weird, but easy to work around and hopefuly fixable on Oracle's end.

brucethemoose commented 2 years ago

Whoops, this is a vanilla issue, closing.