refinedmods / refinedstorage

An elegant solution to your hoarding problem.
https://refinedmods.com/refined-storage
MIT License
359 stars 177 forks source link

Productive Bees sand recipe causes server crash when used by Exporter with crafting upgrade #3485

Open Aubron opened 1 year ago

Aubron commented 1 year ago

Describe the bug

Currently dealing with a crashing ATM8 server, seemingly caused by some kind of bug in the autocrafting network.

Server instantly crashed after removing a crafting pattern, now crashes on startup. I haven't yet managed to create a reliable reproduction case with just RS, but I'm attaching the crash log and a description of what i was doing while I troubleshoot and try and identify the issue.

Relevant logs appear to be:

24.03 16:10:28 [Server] INFO java.lang.IllegalStateException: Recursive calculation didn't yield anything
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateForItems(CraftingCalculator.java:209) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateInternal(CraftingCalculator.java:116) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculate(CraftingCalculator.java:68) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.CraftingTaskFactory.create(CraftingTaskFactory.java:17) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.create(CraftingManager.java:152) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.request(CraftingManager.java:304) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.network.node.ExporterNetworkNode.update(ExporterNetworkNode.java:138) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.network.NetworkListener.onLevelTick(NetworkListener.java:25) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}

How can we reproduce this bug or crash?

  1. I had a recipe for autocrafting Sand, using essence from Mystical Agriculture. There were several places in my system where exporters with crafting upgrades were exporting sand.
  2. I added a new recipe for autocrafting sand (productive bees), but the system didn't seem to use it. This might have been a priority issue, but my immediate solution was to:
  3. Remove the original crafting recipe for sand, probably while exporters were actively trying to use the recipe.

This prompted an immediate crash.

What Minecraft version is this happening on?

Minecraft 1.19.2

What Forge version is this happening on?

43.2.6

What Refined Storage version is this happening on?

1.11.5

Relevant log output

24.03 16:10:28 [Server] INFO java.lang.IllegalStateException: Recursive calculation didn't yield anything
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateForItems(CraftingCalculator.java:209)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateInternal(CraftingCalculator.java:116)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculate(CraftingCalculator.java:68)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.CraftingTaskFactory.create(CraftingTaskFactory.java:17)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.create(CraftingManager.java:152)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.request(CraftingManager.java:304)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.network.node.ExporterNetworkNode.update(ExporterNetworkNode.java:138)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.network.NetworkListener.onLevelTick(NetworkListener.java:25)
24.03 16:10:28 [Server] INFO at TRANSFORMER/refinedstorage@1.11.5/com.refinedmods.refinedstorage.apiimpl.network.__NetworkListener_onLevelTick_LevelTickEvent.invoke(.dynamic)
24.03 16:10:28 [Server] INFO at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
24.03 16:10:28 [Server] INFO at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
24.03 16:10:28 [Server] INFO at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
24.03 16:10:28 [Server] INFO at TRANSFORMER/forge@43.2.3/net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(ForgeEventFactory.java:820)
24.03 16:10:28 [Server] INFO at TRANSFORMER/minecraft@1.19.2/net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:872)
24.03 16:10:28 [Server] INFO at TRANSFORMER/minecraft@1.19.2/net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292)
24.03 16:10:28 [Server] INFO at TRANSFORMER/minecraft@1.19.2/net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806)
24.03 16:10:28 [Server] INFO at TRANSFORMER/minecraft@1.19.2/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654)
24.03 16:10:28 [Server] INFO at TRANSFORMER/minecraft@1.19.2/net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244)
24.03 16:10:28 [Server] INFO at java.base/java.lang.Thread.run(Thread.java:833)
24.03 16:10:28 [Server] Server thread/ERROR Encountered an unexpected exception
24.03 16:10:28 [Server] INFO java.lang.IllegalStateException: Recursive calculation didn't yield anything
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateForItems(CraftingCalculator.java:209) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculateInternal(CraftingCalculator.java:116) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.calculator.CraftingCalculator.calculate(CraftingCalculator.java:68) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.CraftingTaskFactory.create(CraftingTaskFactory.java:17) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.create(CraftingManager.java:152) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingManager.request(CraftingManager.java:304) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.network.node.ExporterNetworkNode.update(ExporterNetworkNode.java:138) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.network.NetworkListener.onLevelTick(NetworkListener.java:25) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading}
24.03 16:10:28 [Server] INFO at com.refinedmods.refinedstorage.apiimpl.network.__NetworkListener_onLevelTick_LevelTickEvent.invoke(.dynamic) ~[refinedstorage-1.11.5.jar%23657!/:1.11.5] {re:classloading,pl:eventbus:B}
24.03 16:10:28 [Server] INFO at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%2351!/:?] {}
24.03 16:10:28 [Server] INFO at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%2351!/:?] {}
24.03 16:10:28 [Server] INFO at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%2351!/:?] {}
24.03 16:10:28 [Server] INFO at net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(ForgeEventFactory.java:820) ~[forge-1.19.2-43.2.3-universal.jar%23748!/:?] {re:classloading}
24.03 16:10:28 [Server] INFO at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:872) ~[server-1.19.2-20220805.130853-srg.jar%23743!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:elementalcraft.mixins.json:MixinMinecraftServer,pl:mixin:A}
24.03 16:10:28 [Server] INFO at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:292) ~[server-1.19.2-20220805.130853-srg.jar%23743!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:nochatreports.mixins.json:server.MixinDedicatedServer,pl:mixin:APP:tombstone.mixins.json:DedicatedServerMixin,pl:mixin:A}
24.03 16:10:28 [Server] INFO at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[server-1.19.2-20220805.130853-srg.jar%23743!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:elementalcraft.mixins.json:MixinMinecraftServer,pl:mixin:A}
24.03 16:10:28 [Server] INFO at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[server-1.19.2-20220805.130853-srg.jar%23743!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:elementalcraft.mixins.json:MixinMinecraftServer,pl:mixin:A}
24.03 16:10:28 [Server] INFO at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244) ~[server-1.19.2-20220805.130853-srg.jar%23743!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:kubejs-common.mixins.json:MinecraftServerMixin,pl:mixin:APP:kubejs-common.mixins.json:inject_resources.MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:APP:ae2.mixins.json:spatial.MinecraftServerMixin,pl:mixin:APP:byg.mixins.json:access.MinecraftServerAccess,pl:mixin:APP:byg.mixins.json:server.MixinMinecraftServer,pl:mixin:APP:elementalcraft.mixins.json:MixinMinecraftServer,pl:mixin:A}
24.03 16:10:28 [Server] INFO at java.lang.Thread.run(Thread.java:833) [?:?] {re:mixin}
24.03 16:10:28 [Server] Server thread/FATAL [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 005abb46-d23d-428b-9bd1-02901bc28fef
24.03 16:10:28 [Server] Server thread/ERROR This crash report has been saved to: /./crash-reports/crash-2023-03-24_16.10.28-server.txt
Aubron commented 1 year ago

Relevant line of code emitting the error appears here: https://github.com/refinedmods/refinedstorage/blob/7b4f733fac4d6bfbdf5d0e17390ef464794c9918/src/main/java/com/refinedmods/refinedstorage/apiimpl/autocrafting/task/v6/calculator/CraftingCalculator.java#L207-L210

Aubron commented 1 year ago

A few more notes here based on exploration:

  1. This was definitely the result of an exporter with a crafting upgrade, crafting and exporting glass, which as a result would downstream autocraft sand
  2. Clearing the tasks list in refinedstorage_networks.dat did not fix the issue, likely because the issue wasn't with a broken task, it was that as soon as the server would boot, the exporter with a crafting upgrade would cause the error with its next crafting operation.
  3. I've worked around this by editing refinedstorage_disks to give me a sand buffer, then starting the server (meaning no sand crafting operation will be attempted)

Continuing to investigate.

Aubron commented 1 year ago

Found the culprit:

javaw_o0Dqc98Qfz

It appears that when using JEI to fill out the autocrafting recipe for sand using productive bees "Sand Chip", exact mode isn't enabled, and the resulting pattern is invalid and dangerous (listed as being made of "Stone Chip", which will not make sand). Recreating the pattern with exact mode creates a safe pattern. At least when this pattern is hit via a crafting exporter, it causes the above crash.

Is this a refinedstorage bug, jei bug, or does this imply Productive Bees has malformed tags somewhere?

dws14159 commented 8 months ago

Is there any reason this has to have such severe consequences? I had this exception after dropping a crafting upgrade into an interface, and every time I started my game it immediately crashed out (Enigmatica 6 Expert). After several tries I had to recover from backup losing hours of "work". If the craft just fails to complete then I could investigate the cause in-game.