Draylar / inmis

I need more inventory space! A Fabric backpack mod.
https://www.curseforge.com/minecraft/mc-mods/inmis
MIT License
33 stars 29 forks source link

Internal Server Crash when opening Inmis backpack #117

Closed milay closed 2 years ago

milay commented 2 years ago

Playing in a single server world. A few minutes after playing, when trying to open the backpack, I get disconnected from the internal server.

The 'latest' log seems to be confirming Inmis as the cause:

[12:39:13] [Netty Server IO #5/ERROR]: Encountered exception while handling in channel with name "inmis:open_backpack" java.util.ConcurrentModificationException: null at java.util.HashMap$HashIterator.nextNode(HashMap.java:1597) ~[?:?] at java.util.HashMap$KeyIterator.next(HashMap.java:1620) ~[?:?] at net.minecraft.class_4558.method_22510(class_4558.java:60) ~[client-intermediary.jar:?] at net.minecraft.class_2066.method_24362(class_2066.java:55) ~[client-intermediary.jar:?] at net.minecraft.class_2066.method_8950(class_2066.java:51) ~[client-intermediary.jar:?] at net.minecraft.class_3222$2.method_7635(class_3222.java:235) ~[client-intermediary.jar:?] at net.minecraft.class_1703.method_34246(class_1703.java:218) ~[client-intermediary.jar:?] at net.minecraft.class_1703.method_7623(class_1703.java:175) ~[client-intermediary.jar:?] at net.minecraft.class_1703.method_7596(class_1703.java:138) ~[client-intermediary.jar:?] at net.minecraft.class_3222.method_14235(class_3222.java:400) ~[client-intermediary.jar:?] at net.minecraft.class_3222.method_17355(class_3222.java:1039) ~[client-intermediary.jar:?] at draylar.inmis.item.BackpackItem.openScreen(BackpackItem.java:58) ~[inmis-2.5.2-1.18.2.jar:?] at draylar.inmis.network.ServerNetworking.receiveOpenBackpackPacket(ServerNetworking.java:45) ~[inmis-2.5.2-1.18.2.jar:?] at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.receive(ServerPlayNetworkAddon.java:89) ~[fabric-networking-api-v1-1.0.21+d882b91560-a8c4d1390f5e44a7.jar:?] at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.receive(ServerPlayNetworkAddon.java:38) ~[fabric-networking-api-v1-1.0.21+d882b91560-a8c4d1390f5e44a7.jar:?] at net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon.handle(AbstractChanneledNetworkAddon.java:100) [fabric-networking-api-v1-1.0.21+d882b91560-a8c4d1390f5e44a7.jar:?] at net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.handle(ServerPlayNetworkAddon.java:84) [fabric-networking-api-v1-1.0.21+d882b91560-a8c4d1390f5e44a7.jar:?] at net.minecraft.class_3244.handler$cim000$handleCustomPayloadReceivedAsync(class_3244.java:1714) [client-intermediary.jar:?] at net.minecraft.class_3244.method_12075(class_3244.java) [client-intermediary.jar:?] at net.minecraft.class_2817.method_12199(class_2817.java:38) [client-intermediary.jar:?] at net.minecraft.class_2817.method_11054(class_2817.java:7) [client-intermediary.jar:?] at net.minecraft.class_2535.method_10759(class_2535.java:172) [client-intermediary.jar:?] at net.minecraft.class_2535.method_10770(class_2535.java:157) [client-intermediary.jar:?] at net.minecraft.class_2535.channelRead0(class_2535.java:55) [client-intermediary.jar:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.local.LocalChannel.readInbound(LocalChannel.java:299) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:445) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:50) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:403) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-all-4.1.68.Final.jar:4.1.68.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.68.Final.jar:4.1.68.Final]


Full log: https://paste.gg/p/anonymous/6a39eb306f24423eae2063b9aa87f609

Happened three times already now, within a relatively short timeframe.

Strangely enough, it worked fine before. I played yesterday and did not notice any problems like that, so I'm not quite sure what happened. The only mod I added since then is Incendium_v5.0.3, a nether generation mod. I don't see how this one could cause any issues?

It also doesn't happen every time I open the backpack. The first few times accessing the backpack works just fine.

milay commented 2 years ago

Played around with it some more. Opening the backpack from the hotbar does not cause any issues. Opening the equipped backpack via hotkey causes the crash, without fail after opening the backpack for the third or fourth time that way (within seconds if I do it right after re-opening the world). Changed the hotkey, same issue still.

spoorn commented 2 years ago

Same here with my modpack: https://www.curseforge.com/minecraft/modpacks/spoornpack-fabric

spoorn commented 2 years ago

I tried adding some thread safety to the class that's breaking in https://www.curseforge.com/minecraft/mc-mods/quality-of-life-qol-fixes, seems to have fixed it.

Wanted to make the change in inmis, except the ShulkerBoxTooltips repo can't load for me

milay commented 2 years ago

That seems to have fixed it for me, thank you so much!

Draylar commented 2 years ago

I was having trouble reproducing this issue, but then I noticed all my Backpack opening logic was running on the network thread. 🤦‍♀️

Haven't been able to confirm this actually fixes the issue (because I can't trigger it), but there's no way this wasn't the problem... please let me know if you run into the issue again. :)