SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.08k stars 373 forks source link

GraaVM Java Error #4416

Closed LiannOM closed 3 years ago

LiannOM commented 3 years ago

Skript/Server Version

1.17.1 Purpur, Latest Skript

Bug Description

Skript doesnt want to load when using https://github.com/etil2jz/etil-minecraft-flags (errors)

Expected Behavior

Skript plugin doesnt work and addons either

Steps to Reproduce

Just use flags that i sent above (enterprise edition) on purpur 1.17.1

Errors or Screenshots

https://pastebin.com/1tTCM2jc

Other

No response

Agreement

TPGamesNL commented 3 years ago

It looks like your aliases failed to load, can you send your server's startup log?

LiannOM commented 3 years ago

It only happens when i use GraaVM on normal java it works well idk why:

i uploaded logs on my server because pastebin or any other hostings doesnt allow such huge files:

https://ocelotmc.pl/logs.txt

i just saw i can attach file here so if you want: logs.txt

BTW: Any other plugins that i use works normally

TPGamesNL commented 3 years ago

Can you send a screenshot of your plugins/Skript directory, from your file explorer / FTP client?

LiannOM commented 3 years ago

Bittern713cffa63-5c74-4a21-9553-845019271536

AyhamAl-Ali commented 3 years ago

[12:25:57 ERROR]: #!#! Java: 17.0.1 (Java HotSpot(TM) 64-Bit Server VM 17.0.1+12-LTS-jvmci-21.3-b05)

Is Java 17 supported by skript? did you test the normal Java 17 or was it Java 16?

LiannOM commented 3 years ago
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

Its my normal java that i run server with aikar flags and it works

So it could be that java 17 is not supported by skript rn... idk

AyhamAl-Ali commented 3 years ago

Can you try the JDK 11 based version?

Link: https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-21.3.0 image

LiannOM commented 3 years ago

yeah i will try it but does minecraft 1.17.1 need java 16+?

AyhamAl-Ali commented 3 years ago

Ah yea I think 1.17 requires Java 16+ however try it if you can image

LiannOM commented 3 years ago

i think it wont work on 1.17+ with java 11 but i will try

LiannOM commented 3 years ago
java.lang.module.FindException: Module jdk.incubator.vector not found
DAEMON
 Running post-execution steps

Nope it wont work anyways

TPGamesNL commented 3 years ago

Can you try removing -Dfile.encoding=UTF-8 from your options?

LiannOM commented 3 years ago

Can you try removing -Dfile.encoding=UTF-8 from your options?

still doesnt work image

TPGamesNL commented 3 years ago

Can you send your startup log again after removing that option?

LiannOM commented 3 years ago

logs.txt

AyhamAl-Ali commented 3 years ago

Could you maybe try to delete the whole Skript folder and let it regenerate again? also without addons maybe

TPGamesNL commented 3 years ago

Can you try redownloading the Skript jar file and using it?

LiannOM commented 3 years ago

logs.txt I did all you are guys said, downloaded fresh skript form https://github.com/SkriptLang/Skript/releases and removed every addon (SkBee) Also regenerated whole Skript folder 2c395jPl

TPGamesNL commented 3 years ago

Can confirm on GraalVM, but only on Enterprise edition, not Community edition. Tested on both Java 11 and Java 17 versions, both produced the issue. The startup arguments are not the problem, without them I can still replicate the issue on versions mentioned above. The weird characters in the log isn't the issue, that's Notepad++'s fault (the latest.log files open with the wrong encoding).

After some debugging, it seems that some aliases aren't properly loaded, which causes the next aliases (which depend on the previous ones, e.g. any granite = raw granite, polished granite) to error. To make this even more interesting (/ frustrating), when I attach my debugger and go step by step, the bug does not occur anymore (only for that single alias I'm stepping through, the rest still don't register properly). I'll do more (probably old-fashioned) debugging later

LiannOM commented 3 years ago

Thanks mate hope it will get resolved.

czw., 11 lis 2021, 20:44 użytkownik TPGamesNL @.***> napisał:

Can confirm on GraalVM, but only on Enterprise edition, not Community edition. Tested on both Java 11 and Java 17 versions, both produced the issue. The startup arguments are not the problem, without them I can still replicate the issue on versions mentioned above. The weird characters in the log isn't the issue, that's Notepad++'s fault (the latest.log files open with the wrong encoding).

After some debugging, it seems that some aliases aren't properly loaded, which causes the next aliases (which depend on the previous ones, e.g. any granite = raw granite, polished granite) to error. To make this even more interesting (/ frustrating), when I attach my debugger and go step by step, the bug does not occur anymore (for that single alias I'm doing stepping through, the rest still go wrong). I'll do more (probably old-fashioned) debugging later

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SkriptLang/Skript/issues/4416#issuecomment-966576190, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATSISNZA37TVFUIVY3A4SKLULQMKVANCNFSM5HXU3BKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

TPGamesNL commented 3 years ago

This is an issue with GraalVM Enterprise edition. I've reported it to them, you can follow it at https://github.com/oracle/graal/issues/4022. TL;DR String#indexOf(int), which Skript uses to determine where the ¦ character is when parsing aliases (among others), doesn't always work.

When loading an alias such as [raw] granite¦s = minecraft:granite, it should convert the name [raw] granite¦s into its single and plural form, raw granite and raw granites. It does this in AliasesParser#getAliasPlural with https://github.com/SkriptLang/Skript/blob/537a6984d6b0e6e6d64fe63058049f6c101c101a/src/main/java/ch/njol/skript/aliases/AliasesParser.java#L627-L632 Because the String#indexOf(int) method can return -1 when it shouldn't, it'll return the input string for the single and plural forms, which will include the ¦. This means the it will be registered under the alias raw granite¦s, while the ¦s part should have been filtered out already. Because aliases depend on the previous aliases, e.g. any granite¦s = raw granite, polished granite, this would error, as raw granite is not registered because of the bug.

@LiannOM Temporary workarounds for this include switching to GraalVM's Community edition, or using -Dgraal.CompilerConfiguration=community to use the community version of Graal's JIT (although some of your startup args may not work with these). Otherwise, you can wait for a new release of GraalVM Enterprise.

As this is not caused by Skript, I'm closing this issue.