Salandora / SophisticatedStorage

https://www.curseforge.com/minecraft/mc-mods/sophisticated-storage-unofficial-fabric-port
1 stars 3 forks source link

Crash on pulling from container with compression upgrade #16

Open Jota-byte opened 2 weeks ago

Jota-byte commented 2 weeks ago

Describe the bug The game crashes when you try to pull items from a container with the compression upgrade. Tested with hopper and funnels from Create on barrel and limited barrel Crash report: https://mclo.gs/EkYpJtn Log: https://mclo.gs/OybwTa9

To Reproduce Steps to reproduce the behavior:

  1. Place a barrel o limited barrel I-IV
  2. Put a compression upgrade in the barrel
  3. Put any compressible item. Tested with iron nuggets to iron blocks
  4. Try to pull items from the barrel by any mean. For example, place a hopper under the container
  5. Instant crash

Expected behavior Not to crash and being able to pull items from containers with the compression upgrade

Screenshots N/A

Versions Minecraft version: 1.20.1 Java version: 17.0.11 Fabric loader version: 0.15.11 Sophisticated Storage: 0.8.60+mc1.20.1-build.104 Sophisticated Core: 0.5.109+mc1.20.1-build.104

Salandora commented 1 week ago

Can confirm this, I did encouter this issze myself a couple times. While it looks like "easy" to reproduce unfortunately I was never able to reproduce it consitantly. I do believe to have a fix for this tho, I jzst can't properly test it. So if you somehow have a setup that can reliably produce this crash please let me know. For me it always crashed randomly and the just works after the crash...

Jota-byte commented 1 week ago

I have no special setup, it's how I described in the post and it happens to me every time I made a new fabric instance only with Fabric Api, Sodium, Indium and Sophisticated Storage, Backpacks and Core. It still happens:

  1. Place an oak barrel (tier 0, 27 slots)
  2. Put the compression upgrade in the upgrade slot
  3. Put 64 copper ingots in the second slot, so that way they turn into copper blocks automatically
  4. Place a hopper under the barrel
  5. Crash. As soon as you place the hopper or you try to pull items by any mean, it crashes and the world become unplayable (crash loop)

Crash report: https://mclo.gs/vl4UNmG Log: https://mclo.gs/scfT9JT

GoldenAlpharex commented 1 week ago

Can confirm this, I did encouter this issze myself a couple times. While it looks like "easy" to reproduce unfortunately I was never able to reproduce it consitantly. I do believe to have a fix for this tho, I jzst can't properly test it. So if you somehow have a setup that can reliably produce this crash please let me know. For me it always crashed randomly and the just works after the crash...

It also works with Applied Energistics 2, if it tries to pull some item from it, it's going to crash, giving the following error log the first time it happened:


org.apache.commons.lang3.NotImplementedException
    at net.p3pp3rf1y.sophisticatedcore.controller.ControllerBlockEntityBase.extract(ControllerBlockEntityBase.java:739)
    at net.p3pp3rf1y.sophisticatedcore.controller.ControllerBlockEntityBase.extract(ControllerBlockEntityBase.java:50)
    at net.p3pp3rf1y.sophisticatedcore.inventory.CachedFailedInsertInventoryHandler.extract(CachedFailedInsertInventoryHandler.java:104)
    at net.p3pp3rf1y.sophisticatedcore.inventory.CachedFailedInsertInventoryHandler.extract(CachedFailedInsertInventoryHandler.java:16)
    at appeng.me.storage.StorageAdapter.extract(StorageAdapter.java:90)
    at appeng.me.storage.CompositeStorage.extract(CompositeStorage.java:57)
    at appeng.me.storage.DelegatingMEInventory.extract(DelegatingMEInventory.java:46)
    at appeng.me.storage.MEInventoryHandler.extract(MEInventoryHandler.java:95)
    at appeng.me.storage.NetworkStorage.extract(NetworkStorage.java:225)
    at appeng.api.storage.StorageHelper.poweredExtraction(StorageHelper.java:92)
    at appeng.parts.automation.StorageExportStrategy.transfer(StorageExportStrategy.java:54)
    at appeng.parts.automation.StackExportFacade.transfer(StackExportFacade.java:24)
    at appeng.parts.automation.ExportBusPart.doBusWork(ExportBusPart.java:158)
    at appeng.parts.automation.IOBusPart.tickingRequest(IOBusPart.java:208)
    at appeng.me.service.TickManagerService.unsafeTickingRequest(TickManagerService.java:359)
    at appeng.me.service.TickManagerService.tickQueue(TickManagerService.java:122)
    at appeng.me.service.TickManagerService.tickLevelQueue(TickManagerService.java:94)
    at appeng.me.service.TickManagerService.onLevelEndTick(TickManagerService.java:79)
    at appeng.me.Grid.onLevelEndTick(Grid.java:229)
    at appeng.hooks.ticking.TickHandler.onServerLevelTickEnd(TickHandler.java:252)
    at net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.lambda$static$6(ServerTickEvents.java:63)
    at net.minecraft.class_3218.handler$dbg000$fabric-lifecycle-events-v1$endWorldTick(class_3218.java:13740)
    at net.minecraft.class_3218.method_18765(class_3218.java:396)
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897)
    at net.minecraft.class_3176.method_3813(class_3176.java:283)
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)
    at java.base/java.lang.Thread.run(Thread.java:833)```

Hope this helps with reproducing the issue, or at least fixing it. If you need someone to test your fix, I can update the mod on our server to see if the fix worked or not.
Kaiede commented 4 days ago

I'll add that I hit something very similar to this trying to use Create with brass funnels and storage controllers to extract from a limited barrel with a compression upgrade. 100% repro to the point that I've gotten unloadable worlds while testing as a result because the crash happens again on the first tick after loading the world:

Changing things around to make it so that the funnel has a filter on it before getting linked to the barrel doesn't help in this case, but after seeing the crash log it clearly wouldn't help:

---- Minecraft Crash Report ----
// My bad.

Time: 2024-07-01 08:27:32
Description: Ticking block entity

java.lang.RuntimeException: Encountered an exception while invoking a transaction close callback.
    at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl$TransactionImpl.close(TransactionManagerImpl.java:141)
    at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl$TransactionImpl.abort(TransactionManagerImpl.java:181)
    at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl$TransactionImpl.close(TransactionManagerImpl.java:192)
    at com.simibubi.create.foundation.item.ItemHelper.extract(ItemHelper.java:238)
    at com.simibubi.create.foundation.blockEntity.behaviour.inventory.InvManipulationBehaviour.extract(InvManipulationBehaviour.java:78)
    at com.simibubi.create.content.logistics.funnel.FunnelBlockEntity.activateExtractingBeltFunnel(FunnelBlockEntity.java:219)
    at com.simibubi.create.content.logistics.funnel.FunnelBlockEntity.tick(FunnelBlockEntity.java:112)
    at com.simibubi.create.foundation.blockEntity.SmartBlockEntityTicker.tick(SmartBlockEntityTicker.java:15)
    at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:662)
    at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:716)
    at net.minecraft.class_1937.method_18471(class_1937.java:470)
    at net.minecraft.class_3218.method_18765(class_3218.java:390)
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897)
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)
    at net.minecraft.class_1132.method_3748(class_1132.java:105)
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: May not call getCurrentUnsafe() from a close callback.
    at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl.getCurrentUnsafe(TransactionManagerImpl.java:53)
    at net.fabricmc.fabric.api.transfer.v1.transaction.Transaction.getCurrentUnsafe(Transaction.java:127)
    at net.p3pp3rf1y.sophisticatedstorage.upgrades.compression.CompressionInventoryPart.setStackInSlot(CompressionInventoryPart.java:605)
    at net.p3pp3rf1y.sophisticatedcore.inventory.InventoryHandler$InventoryHandlerSlot.setStack(InventoryHandler.java:537)
    at net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage.readSnapshot(SingleStackStorage.java:165)
    at net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage.readSnapshot(SingleStackStorage.java:42)
    at net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant.onClose(SnapshotParticipant.java:117)
    at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl$TransactionImpl.close(TransactionManagerImpl.java:138)
    ... 17 more
Salandora commented 4 days ago

Apparently I forgot to mention here, I was finally able to reproduce the issue reliably and fixed it in dev.

Kaiede commented 6 hours ago

I can confirm that the fix works great with Create funnels/chutes in the sort of setups I would be building (bulk ore processing feeding into compression barrels). Thanks for this. Looking forward to the update being more widely available.