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

[Bug]: Incompatibility with Lithium Minecraft 1.21 #28

Closed
1 task done
DarkCows opened this issue Aug 1, 2024 · 12 comments
Closed
1 task done

[Bug]: Incompatibility with Lithium Minecraft 1.21 #28

DarkCows opened this issue Aug 1, 2024 · 12 comments

Comments

@DarkCows
Copy link

DarkCows commented Aug 1, 2024

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

@Franco227
Copy link

Can confirm, same error, also on fabric 1.21

@someaddons
Copy link
Owner

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

@lugui1998
Copy link

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#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

@someaddons
Copy link
Owner

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

@bafb
Copy link

bafb commented Sep 26, 2024

@lugui1998
Copy link

lugui1998 commented Oct 7, 2024

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
Copy link

lugui1998 commented Oct 7, 2024

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
Copy link

This is the PR: CaffeineMC/lithium#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
Copy link

Franco227 commented Oct 8, 2024

@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
Copy link
Owner

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.

@Franco227
Copy link

From 2No2Name :
"Possible workaround is adding the line mixin.minimal_nonvanilla.world.expiring_chunk_tickets=false to the lithium.properties file"

@someaddons
Copy link
Owner

reworked a bunch of stuff in 5.1, may randomly work now? 🤷

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

No branches or pull requests

5 participants