[Bug]: Incompatibility with Lithium Minecraft 1.21
DarkCows opened this issue · 11 comments
Describe the bug you're experiencing
The server crashes whenever a chunk is loaded by a player when lithium and betterchunkloading are installed.
Crash log is below
Reproducability
Join a server as a player. The server doesn't immediately crash due to the initial chunks being preloaded, but as soon as the player moves into unloaded chunks, the server crashes.
Mod up to date
- Before submitting this issue I updated to the newest version and reproduced it
Minecraft version
1.21
Modloader version
Fabric
Logs
https://gist.github.com/DarkCows/4a8b8d45dfaeea1b9e483e6bec769e27
Thats a fault on lithiums side, better chunk loading is just adding a Ticket, while lithiums coremodding fails, report to lithium
Thats a fault on lithiums side, better chunk loading is just adding a Ticket, while lithiums coremodding fails, report to lithium
according to this reply on the issue linked by Franco227:
CaffeineMC/lithium-fabric#535 (comment)
Unclear how this happens unless adding the ticket is done via an unusual path or the ticket is modified after being added
I think it might worth to check @someaddons if this surely isn't something on betterchunkloading.
I don't have much experience with this sort of optimziation mod, so, it would be really nice if you also considered pointing the problem with Lithium on the related issue, your input on that issue would be more valuable in order to get the issue fixed on Lithium
No betterchunkloading does use the normal way of adding tickets, nothing fancy nor mixin into it
So, I decided to try to fix it myself, which is considerably harder since this plugin isn't open source, but I've got some information that might help the author to fix the issue.
the incompatibility issue is caused on Lithium due to a NPE that is likely caused by this mod pushing a null tickets list at some point.
@DarkCows, @Franco227 and @bafb would you happen to be running this mod too?
To find this out I simply patched Lithium where it was having an issue with the error " Cannot invoke "net.minecraft.class_4706.isEmpty()" because "tickets" is null".
I simply added a check "tickets != null", in order to get past that error. So, after that, finding the cause of "tickets" being null was the real task. Now, this is what I get on my logs:
[Server thread/WARN]: Mixin apply for mod betterchunkloading failed betterchunkloading.mixins.json:ChunkMapViewDistanceFixed from mod betterchunkloading -> net.minecraft.class_3204: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException @At("INVOKE") on net/minecraft/class_3204::onSetViewDistance with priority 200 cannot inject into net/minecraft/class_3204::method_14049(I)V merged by com.ishland.c2me.notickvd.mixin.MixinChunkTicketManager with priority 1100 [modify$zbg000$betterchunkloading$onSetViewDistance(I)I -> Prepare -> -> { target: method_14049(I)V }]
org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @At("INVOKE") on net/minecraft/class_3204::onSetViewDistance with priority 200 cannot inject into net/minecraft/class_3204::method_14049(I)V merged by com.ishland.c2me.notickvd.mixin.MixinChunkTicketManager with priority 1100 [modify$zbg000$betterchunkloading$onSetViewDistance(I)I -> Prepare -> -> { target: method_14049(I)V }]
at org.spongepowered.asm.mixin.injection.code.Injector.findTargetNodes(Injector.java:312) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.injection.code.Injector.find(Injector.java:248) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.prepare(InjectionInfo.java:475) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinTargetContext.prepareInjections(MixinTargetContext.java:1407) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.prepareInjections(MixinApplicatorStandard.java:731) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:315) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:246) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:437) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:418) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:234) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:202) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:422) ~[fabric-loader-0.16.5.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:323) ~[fabric-loader-0.16.5.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) ~[fabric-loader-0.16.5.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) ~[fabric-loader-0.16.5.jar:?]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
at net.minecraft.class_3215.<init>(class_3215.java:84) ~[server-intermediary.jar:?]
at net.minecraft.class_3218.<init>(class_3218.java:242) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_3786(MinecraftServer.java:377) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_3735(MinecraftServer.java:342) ~[server-intermediary.jar:?]
at net.minecraft.class_3176.method_3823(class_3176.java:185) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:664) ~[server-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:281) ~[server-intermediary.jar:?]
at java.base/java.lang.Thread.run(Thread.java:1570) [?:?]
[14:06:51] [Server thread/INFO]: Loaded config for: betterchunkloading.json
[14:06:51] [Server thread/INFO]: Using TheSpeedyObjectFactory with Unsafe
[14:06:53] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[14:06:54] [c2me-worker-3/INFO]: Preparing spawn area: 0%
Since Im unable to inspect this plugin's source I decided to post the problem here.
I'll further investigate c2me and post an issue there too when I've got more info, for now, I hope this helps you to investigate on your side @someaddons
So, I patched Lithium by adding the null check to unregisterExpiringTicket
, but the problem still stands as I find it improbable that the ticket list should ever be null. Given that, I wonder if while the server isn't crashing, betterchunkloading is doing something at all given the fact it betterchunkloading.mixins.json:ChunkMapViewDistanceFixed
fails to be applied in the presence of c2me.
This is the PR: CaffeineMC/lithium-fabric#568
for the author of this plugin, I strongly recommend checking if at any point your plugin calls for registerExpiringTicket
passing a null value for the param ticketsAtPos
@DarkCows, @Franco227 and @bafb would you happen to be running this mod too?
If you are talking about C2ME, yes I do, but the issue still occurs without it.
thats normal, since C2ME has some overwrites a mixin fails to apply but thats not an issue.
https://github.com/someaddons/betterchunkloading/tree/neo1.21
So, I decided to try to fix it myself, which is considerably harder since this plugin isn't open source, but I've got some information that might help the author to fix the issue. the incompatibility issue is caused on Lithium due to a NPE that is likely caused by this mod pushing a null tickets list at some point. @DarkCows, @Franco227 and @bafb would you happen to be running this mod too? To find this out I simply patched Lithium where it was having an issue with the error " Cannot invoke "net.minecraft.class_4706.isEmpty()" because "tickets" is null". I simply added a check "tickets != null", in order to get past that error. So, after that, finding the cause of "tickets" being null was the real task. Now, this is what I get on my logs:
[Server thread/WARN]: Mixin apply for mod betterchunkloading failed betterchunkloading.mixins.json:ChunkMapViewDistanceFixed from mod betterchunkloading -> net.minecraft.class_3204: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException @At("INVOKE") on net/minecraft/class_3204::onSetViewDistance with priority 200 cannot inject into net/minecraft/class_3204::method_14049(I)V merged by com.ishland.c2me.notickvd.mixin.MixinChunkTicketManager with priority 1100 [modify$zbg000$betterchunkloading$onSetViewDistance(I)I -> Prepare -> -> { target: method_14049(I)V }] org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @At("INVOKE") on net/minecraft/class_3204::onSetViewDistance with priority 200 cannot inject into net/minecraft/class_3204::method_14049(I)V merged by com.ishland.c2me.notickvd.mixin.MixinChunkTicketManager with priority 1100 [modify$zbg000$betterchunkloading$onSetViewDistance(I)I -> Prepare -> -> { target: method_14049(I)V }] at org.spongepowered.asm.mixin.injection.code.Injector.findTargetNodes(Injector.java:312) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.injection.code.Injector.find(Injector.java:248) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.prepare(InjectionInfo.java:475) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinTargetContext.prepareInjections(MixinTargetContext.java:1407) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.prepareInjections(MixinApplicatorStandard.java:731) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:315) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:246) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:437) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:418) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:234) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:202) ~[sponge-mixin-0.15.3+mixin.0.8.7.jar:0.15.3+mixin.0.8.7] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:422) ~[fabric-loader-0.16.5.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:323) ~[fabric-loader-0.16.5.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) ~[fabric-loader-0.16.5.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) ~[fabric-loader-0.16.5.jar:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?] at net.minecraft.class_3215.<init>(class_3215.java:84) ~[server-intermediary.jar:?] at net.minecraft.class_3218.<init>(class_3218.java:242) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_3786(MinecraftServer.java:377) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_3735(MinecraftServer.java:342) ~[server-intermediary.jar:?] at net.minecraft.class_3176.method_3823(class_3176.java:185) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:664) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:281) ~[server-intermediary.jar:?] at java.base/java.lang.Thread.run(Thread.java:1570) [?:?] [14:06:51] [Server thread/INFO]: Loaded config for: betterchunkloading.json [14:06:51] [Server thread/INFO]: Using TheSpeedyObjectFactory with Unsafe [14:06:53] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld [14:06:54] [c2me-worker-3/INFO]: Preparing spawn area: 0%
Since Im unable to inspect this plugin's source I decided to post the problem here. I'll further investigate c2me and post an issue there too when I've got more info, for now, I hope this helps you to investigate on your side @someaddons
You just need to select a branch to view the code 🤷
https://github.com/someaddons/betterchunkloading/tree/neo1.21
That mixin errors is unrelated, C2ME just has an overwrite there which causes the mixin to fail, but it failing is not an issue.