Creative exporters crash the server when used on inventories connected to an external storage
Nevrai opened this issue · 5 comments
I’ve found that the server crashes whenever I use a creative exporter to export items into an inventory that is connected to an external storage. This has happened on three separate occasions:
-
I had a Mekanism dynamic tank filled with brine (a liquid). I was exporting brine into the tank with a creative exporter, and as soon as I connected an external storage to that tank, the server crashed.
-
I had a Sophisticated Storage barrel with max stack upgrades. The barrel had about 40K raw iron in it (in one slot). I was exporting the raw iron into it with a creative exporter. Attaching an external storage to the barrel also crashed the server.
-
I had a Functional Storage storage controller connected to several drawers. It had an external storage connected to it. Attaching a creative exporter to it and then adding raw copper to the filter crashed the server.
I reported this on the Refined Storage issue tracker, but I’ve since realized that this is a problem with Cable Tiers, from what I can tell, since this only happens when using a creative exporter from Cable Tiers. I first thought it had something to do with the inventories containing a large number of items, but I’m not sure. In the drawer situation, the creative exporter worked fine until I added a fourth Netherite upgrade to the drawer, from what I remember, so maybe it has something to do with transferring a large number of items instantly, in conjunction with there being an external storage attached to the inventory. I’m not sure.
I tried again several times with each of these inventories, but it always crashes the server each time. I’m not playing on a server, by the way; this is in single-player. When I say it crashes the server, I mean the server hangs. I.e., you can’t interact with anything, drop items, pick up items, etc. You’re forced to restart, and leaving the world crashes the game. No crash report was generated any of these times, nor did I find anything in the latest.log. Nothing new shows up in the latest.log when the server crashes.
Using ultra exporters is fine, but as soon as I use a creative exporter on any inventory that has an external storage connected to it, the server immediately crashes. It seems as though Refined Storage might have trouble with exporting items instantly when they’re also in the storage system using an external storage.
I’m using the latest version of both Cable Tiers and Refined Storage. Refined Storage isn’t on the latest version in the modpack I’m playing, but I updated it manually. This also happened when using version 1.10.2 of Refined Storage and version 0.5461 of Cable Tiers.
Versions
- Modpack: All the Mods 7 (version 0.4.27—latest)
- Minecraft: 1.18.2
- Forge: 40.1.68
- Cable Tiers: 0.547 (latest)
- Refined Storage: 1.10.3 (latest)
The server may just be stuck (a hang) instead of an actual crash.
Can you please
a) try to reproduce in All the Mods 8 or in 1.19.2 + the latest version of Cable Tiers and Refined Storage?
b) run spark profiler start --timeout 60
before attempting to reproduce (and try to reproduce the hang in that time)?
I can say that in ATM8 1.19.2 I created a fresh new world just to replicate the above and I did. The barrel is empty and there isn't anything even in the network. The second you slap a Creative Exporter on the inventory of something with an External Storage on it and then attach a cable to bring it into the network the "Server" (also I'm on single player just to quickly replicate it) goes into Waiting for server... and never stops. I had to delete the single player world and just start over to get back in.
I have been having this issue for a while now. I am able to use 1 creative importer with no issues. As soon as a second is added I get the "waiting for server" prompt.
I am currently playing on ATM8 1.0.15
I believe we have a server that is running into this problem. Here's a flamegraph of what the server thread is doing after running 7 minutes with the watchdog disabled:
You can see that it's stuck in the loop where doItemInsertion
is called until it returns a false
.
The 2 main calls it makes are to:
com.refinedmods.refinedstorage.api.network.INetwork.extractItem
net.minecraftforge.items.ItemHandlerHelper.insertItemStacked
This suggests that it is descending into this block:
And retuning true
on line 241 as the method is exiting and being run again.
We need to figure out the scenario that allows this to happen.
It could just be caused by a lot of items in this case. There are a lot of calls to retrieve and compare capability data. I've seen these to cause problems for RS when storage contains items that have a lot of varying capabilities (and NBT data).
I'm leaving the server running for a few hours to see if it ever completes. EDIT - After 2 hours it still hadn't finished a tick. I think we can be sure it's stuck in an infinite loop.
There needs to be a limit on the number of times a Creative Exporter or Importer tries to insert or extract items or fluid, else the server may enter an infinite loop if doItemInsertion
, doFluidInsertion
, doItemExtraction
or doFluidExtraction
repeatedly returns true for a given context. Applying this change would also fully fix #38, not just fix it for specific blocks.