someaddons / betterchunkloading

MInecraft mod which improves chunk loading speeds and locations
1 stars 0 forks source link

[Bug]: Incompatibility with Lithium Minecraft 1.21 #28

Open DarkCows opened 3 months ago

DarkCows commented 3 months ago

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

Minecraft version

1.21

Modloader version

Fabric

Logs

https://gist.github.com/DarkCows/4a8b8d45dfaeea1b9e483e6bec769e27

Franco227 commented 2 months ago

Can confirm, same error, also on fabric 1.21

someaddons commented 2 months ago

Thats a fault on lithiums side, better chunk loading is just adding a Ticket, while lithiums coremodding fails, report to lithium

lugui1998 commented 1 month ago

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: https://github.com/CaffeineMC/lithium-fabric/issues/535#issuecomment-2291852699

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

someaddons commented 1 month ago

No betterchunkloading does use the normal way of adding tickets, nothing fancy nor mixin into it

bafb commented 1 month ago

crash-2024-09-25_19.02.30-server.txt

lugui1998 commented 4 weeks ago

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

lugui1998 commented 4 weeks ago

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.

lugui1998 commented 4 weeks ago

This is the PR: https://github.com/CaffeineMC/lithium-fabric/pull/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

Franco227 commented 3 weeks ago

@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.

someaddons commented 3 days ago

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.