Refined Storage

Refined Storage

77M Downloads

java.lang.IllegalArgumentException: Cannot accept empty stack

bigtruckin78 opened this issue ยท 16 comments

commented

Describe the bug

Game crashed while using the wireless crafting grid. One time I was accessing growth accelerators from Mystical Agriculture. The other time I was manually crafting a pressurized reaction chamber from Mekanism.

crash-2023-01-19_22.02.41-server.txt
crash-2023-01-19_21.23.00-server.txt

How can we reproduce this bug or crash?

Seems to be random as I cannot purposefully get it to crash.

What Minecraft version is this happening on?

Minecraft 1.19.2

What Forge version is this happening on?

43.2.3

What Refined Storage version is this happening on?

1.11.4

Relevant log output

Time: 2023-01-19 22:02:42
Description: Exception in server tick loop

java.lang.IllegalArgumentException: Cannot accept empty stack
at com.refinedmods.refinedstorage.apiimpl.util.ItemStackList.add(ItemStackList.java:35) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.util.ItemStackList.add(ItemStackList.java:19) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.storage.cache.ItemStorageCache.add(ItemStorageCache.java:76) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.storage.cache.ItemStorageCache.add(ItemStorageCache.java:26) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorageCache.update(ItemExternalStorageCache.java:82) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorage.update(ItemExternalStorage.java:43) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.network.node.ExternalStorageNetworkNode.update(ExternalStorageNetworkNode.java:98) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.network.NetworkListener.onLevelTick(NetworkListener.java:25) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading}
at com.refinedmods.refinedstorage.apiimpl.network.NetworkListener_onLevelTick_LevelTickEvent.invoke(.dynamic) ~[refinedstorage-1.11.4.jar%23676!/:1.11.4] {re:classloading,pl:eventbus:B}
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23106!/:?] {}
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23106!/:?] {}
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23106!/:?] {}
at net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(ForgeEventFactory.java:820) ~[forge-1.19.2-43.2.3-universal.jar%23782!/:?] {re:classloading}
at net.minecraft.server.MinecraftServer.m_5703
(MinecraftServer.java:872) ~[client-1.19.2-20220805.130853-srg.jar%23777!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.server.MinecraftServer.m_5705
(MinecraftServer.java:806) ~[client-1.19.2-20220805.130853-srg.jar%23777!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:84) ~[client-1.19.2-20220805.130853-srg.jar%23777!/:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[client-1.19.2-20220805.130853-srg.jar%23777!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[client-1.19.2-20220805.130853-srg.jar%23777!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at java.lang.Thread.run(Thread.java:833) [?:?] {re:mixin}

commented

@Darkere I find it confusing, the external storage cache should avoid that

commented

crash unrelated to your grid. One of the inventories you have connected via external storage is sending empty or negative count stacks.

commented

After double checking I'm a bit baffled at how this can happen in the first place

We check for > 0 before commiting to the stacklist. Multihreading issue?

commented

Could be that the actual stack is empty-ified after the delta > 0 check... We could make a defensive actual copy but that is quite heavy performance wise and the cache was meant to alleviate those copies...

commented

Also, an isEmpty = true stack that has count > 0 is impossible so it must be a multithreading issue I think

commented

The crash was happening even when AFK, so I used that to my advantage and started removing external storage nodes one at a time and letting the game sit. The problem seemed to stop when I removed the external storage that was hooked up to a Functional Storage Controller. I replaced the storage node on the controller and eventually the game crashed again. Don't know if that helps or not.

commented

Did anyone find a replacement mod for Functional Storage ? I will switch to a different mod with the same functionality to avoid this issue until it is fixed. Thanks.

commented

Anyone able to upload a world where this issue happens? So we can investigate?

commented

Yes I can provide a world where this can be tested(it crashes fairly often if a lot of items are imported into the RS system quickly).
Where and how can I provide the world ?

commented

Upload somewhere, and share a link

commented

Here is my world
https://mega.nz/file/bd83kJgR#LXZ0-SIUFPKUid8DGFIR9BNRuVWsv5hZjJkH5AHMmvo
Currently the RS system is overloaded with items that go into the drawers connected with the problematic external storage.
It will crash ~1 time per minute. If you want to stabilize it you can turn off the RS Interfaces at -221 61 90.
This world is from direwolf20 1.19.2 modpack version 1.2.1(FTB launcher).

External storage coords: -222 58 91

commented

For me updating java from 17 to 19 seems to have stopped the empty stack problem

I used a guide that said java 17 was better so was using it as java 8 crashed minecraft 1.19

commented

For me updating java from 17 to 19 seems to have stopped the empty stack problem

I used a guide that said java 17 was better so was using it as java 8 crashed minecraft 1.19

I am currently running java 17. Will try upgrading to java 19 and see if this fixes the issue :)

commented

Locking this as too much misinformation is being posted. Please provide us with test worlds on our discord server to resolve this issue.

commented

Can confirm that java 19 solved this issue for me as well! Thank you very much for finding this solution @Pultex ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

commented

After a lot of debugging the issue has been tracked down to Silent Gear.

Solutions:

  • avoid having items from silent gear in your inventory
  • play on a server

We will implement a safeguard against it for the next version.
Reported here: SilentChaos512/Silent-Gear#584