[1.18.2] Transferring 0 items crashes server
Nixill opened this issue · 9 comments
If you're not careful and write a program that attempts to transfer 0 of an item between item_storage
s, the entire server it's running on crashes.
(Edit: Hiding the crash log under a <details> tag!)
Here's the crash log:
---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!
Time: 3/29/23, 1:35 AM
Description: Ticking block entity
java.lang.IllegalStateException: An outer transaction is already active on this thread.
at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl.openOuter(TransactionManagerImpl.java:40)
at net.fabricmc.fabric.api.transfer.v1.transaction.Transaction.openOuter(Transaction.java:89)
at techreborn.blockentity.cable.CableTickManager$SortableStorage.<init>(CableTickManager.java:177)
at techreborn.blockentity.cable.CableTickManager.dispatchTransfer(CableTickManager.java:139)
at techreborn.blockentity.cable.CableTickManager.handleCableTick(CableTickManager.java:78)
at techreborn.blockentity.cable.CableBlockEntity.tick(CableBlockEntity.java:261)
at techreborn.blocks.cable.CableBlock.lambda$getTicker$1(CableBlock.java:118)
at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:659)
at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:713)
at net.minecraft.class_1937.method_18471(class_1937.java:475)
at net.minecraft.class_3218.method_18765(class_3218.java:368)
at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:907)
at net.minecraft.class_3176.method_3813(class_3176.java:322)
at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:851)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:697)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:273)
at java.base/java.lang.Thread.run(Thread.java:833)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Server thread
Stacktrace:
at net.fabricmc.fabric.impl.transfer.transaction.TransactionManagerImpl.openOuter(TransactionManagerImpl.java:40)
at net.fabricmc.fabric.api.transfer.v1.transaction.Transaction.openOuter(Transaction.java:89)
at techreborn.blockentity.cable.CableTickManager$SortableStorage.<init>(CableTickManager.java:177)
at techreborn.blockentity.cable.CableTickManager.dispatchTransfer(CableTickManager.java:139)
at techreborn.blockentity.cable.CableTickManager.handleCableTick(CableTickManager.java:78)
at techreborn.blockentity.cable.CableBlockEntity.tick(CableBlockEntity.java:261)
at techreborn.blocks.cable.CableBlock.lambda$getTicker$1(CableBlock.java:118)
at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:659)
at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:713)
at net.minecraft.class_1937.method_18471(class_1937.java:475)
at net.minecraft.class_3218.method_18765(class_3218.java:368)
-- Block entity being ticked --
Details:
Name: techreborn:cable // techreborn.blockentity.cable.CableBlockEntity
Block: Block{techreborn:insulated_gold_cable}[covered=true,down=false,east=false,north=true,south=false,up=true,waterlogged=false,west=false]
Block location: World: (206,80,113), Section: (at 14,0,1 in 12,5,7; chunk contains blocks 192,-64,112 to 207,319,127), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
Block: Block{techreborn:insulated_gold_cable}[covered=true,down=false,east=false,north=true,south=false,up=true,waterlogged=false,west=false]
Block location: World: (206,80,113), Section: (at 14,0,1 in 12,5,7; chunk contains blocks 192,-64,112 to 207,319,127), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
Stacktrace:
at net.minecraft.class_2818$class_5563.method_31703(class_2818.java:659)
at net.minecraft.class_2818$class_5564.method_31703(class_2818.java:713)
at net.minecraft.class_1937.method_18471(class_1937.java:475)
at net.minecraft.class_3218.method_18765(class_3218.java:368)
at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:907)
at net.minecraft.class_3176.method_3813(class_3176.java:322)
at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:851)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:697)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:273)
at java.base/java.lang.Thread.run(Thread.java:833)
-- Affected level --
Details:
All players: 1 total; [class_3222['ShadowFoxNixill'/382710, l='ServerLevel[Stream World 2]', x=196.54, y=68.00, z=106.72]]
Chunk stats: 5044
Level dimension: minecraft:overworld
Level spawn location: World: (195,81,126), Section: (at 3,1,14 in 12,5,7; chunk contains blocks 192,-64,112 to 207,319,127), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
Level time: 211206946 game time, 22787931 day time
Level name: Stream World 2
Level game mode: Game mode: adventure (ID 2). Hardcore: false. Cheats: false
Level weather: Rain time: 108061 (now: false), thunder time: 56434 (now: false)
Known server brands: fabric
Level was modded: true
Level storage version: 0x04ABD - Anvil
Stacktrace:
at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:907)
at net.minecraft.class_3176.method_3813(class_3176.java:322)
at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:851)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:697)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:273)
at java.base/java.lang.Thread.run(Thread.java:833)
-- System Details --
Details:
Minecraft Version: 1.18.2
Minecraft Version ID: 1.18.2
Operating System: Linux (amd64) version 5.17.5-300.fc36.x86_64
Java Version: 17, Oracle Corporation
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
Memory: 2184073912 bytes (2082 MiB) / 4202692608 bytes (4008 MiB) up to 4294967296 bytes (4096 MiB)
CPUs: 8
Processor Vendor: GenuineIntel
Processor Name: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Identifier: Intel64 Family 6 Model 142 Stepping 12
Microarchitecture: whiskey Lake
Frequency (GHz): 1.60
Number of physical packages: 1
Number of physical CPUs: 4
Number of logical CPUs: 8
Graphics card #0 name: CometLake-U GT2 [UHD Graphics]
Graphics card #0 vendor: Intel Corporation (0x8086)
Graphics card #0 VRAM (MB): 256.00
Graphics card #0 deviceId: 0x9b41
Graphics card #0 versionInfo: unknown
Virtual memory max (MB): 11490.34
Virtual memory used (MB): 5887.97
Swap memory total (MB): 7660.00
Swap memory used (MB): 189.25
JVM Flags: 1 total; -Xmx4G
Fabric Mods:
ae2: Applied Energistics 2 11.6.6
appleskin: AppleSkin 2.4.1+mc1.18.2
architectury: Architectury 4.10.86
betteranvil: Better Anvil 1.1.3
byg: Oh The Biomes You'll Go 1.4
charm: Charm 4.4.4
com_moandjiezana_toml_toml4j: toml4j 0.7.2
chisel: Chisel Refabricated 1.4.5
cloth-config: Cloth Config v6 6.4.90
cloth-basic-math: cloth-basic-math 0.6.1
collective-fabric: Collective (Fabric) 5.16
fiber: fiber 0.23.0-2
computercraft: CC: Restitched 1.100.8
cloth-utils-v1: Cloth Utils v1 2.0.54
convenient-mobgriefing: Convenient mobGriefing 2.0.2
croptopia: Croptopia 2.1.2
com_typesafe_config: config 1.4.1
io_leangen_geantyref_geantyref: geantyref 1.3.11
org_spongepowered_configurate-core: configurate-core 4.1.2
org_spongepowered_configurate-hocon: configurate-hocon 4.1.2
damagetilt: Damage Tilt 1.18-fabric-0.1.2
fabric-api: Fabric API 0.67.0+1.18.2
fabric-api-base: Fabric API Base 0.4.4+d7c144a860
fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.2+2373a54560
fabric-biome-api-v1: Fabric Biome API (v1) 8.0.6+651bcc5960
fabric-block-api-v1: Fabric Block API (v1) 1.0.0+ee3621fc60
fabric-command-api-v1: Fabric Command API (v1) 1.1.9+d7c144a860
fabric-commands-v0: Fabric Commands (v0) 0.2.8+b4f4f6cd60
fabric-containers-v0: Fabric Containers (v0) 0.1.23+d7c144a860
fabric-content-registries-v0: Fabric Content Registries (v0) 3.1.1+c85f2e3860
fabric-convention-tags-v1: Fabric Convention Tags 1.0.1+474e4f7960
fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.1+ee261a3e60
fabric-data-generation-api-v1: Fabric Data Generation API (v1) 3.0.2+9fcb91d260
fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.20+489d6f8260
fabric-entity-events-v1: Fabric Entity Events (v1) 1.4.8+d7c144a860
fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.19+d7c144a860
fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.20+d7c144a860
fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.13+d7c144a860
fabric-item-api-v1: Fabric Item API (v1) 1.6.0+d8cf4e5a60
fabric-item-groups-v0: Fabric Item Groups (v0) 0.3.14+91896a4960
fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.1.0+cc71601c60
fabric-loot-api-v2: Fabric Loot API (v2) 1.1.0+1997ad1260
fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.1.2+e747827960
fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.4+cc71601c60
fabric-networking-api-v1: Fabric Networking API (v1) 1.0.23+2d30af4b60
fabric-networking-v0: Fabric Networking (v0) 0.3.10+b4f4f6cd60
fabric-object-builder-api-v1: Fabric Object Builder API (v1) 2.1.3+032c981d60
fabric-particles-v1: Fabric Particles (v1) 0.2.12+526dc1ac60
fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.9.11+bb2e047760
fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.8+ee3621fc60
fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 2.0.2+54e5b2ec60
fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.0.3+91b7aa6660
fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.5.2+446e059560
fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.2.2+1f6558e860
fabric-transfer-api-v1: Fabric Transfer API (v1) 1.6.3+f4563ac860
fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 1.1.0+e747827960
fabric-language-kotlin: Fabric Language Kotlin 1.8.6+kotlin.1.7.21
org_jetbrains_kotlin_kotlin-reflect: kotlin-reflect 1.7.21
org_jetbrains_kotlin_kotlin-stdlib: kotlin-stdlib 1.7.21
org_jetbrains_kotlin_kotlin-stdlib-jdk7: kotlin-stdlib-jdk7 1.7.21
org_jetbrains_kotlin_kotlin-stdlib-jdk8: kotlin-stdlib-jdk8 1.7.21
org_jetbrains_kotlinx_atomicfu-jvm: atomicfu-jvm 0.18.5
org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm: kotlinx-coroutines-core-jvm 1.6.4
org_jetbrains_kotlinx_kotlinx-coroutines-jdk8: kotlinx-coroutines-jdk8 1.6.4
org_jetbrains_kotlinx_kotlinx-datetime-jvm: kotlinx-datetime-jvm 0.4.0
org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm: kotlinx-serialization-cbor-jvm 1.4.1
org_jetbrains_kotlinx_kotlinx-serialization-core-jvm: kotlinx-serialization-core-jvm 1.4.1
org_jetbrains_kotlinx_kotlinx-serialization-json-jvm: kotlinx-serialization-json-jvm 1.4.1
fabricloader: Fabric Loader 0.14.10
factory_blocks: Factory Blocks Mod 1.0.0+1.18.2
feature_nbt_deadlock_be_gone: Feature NBT Deadlock Be Gone - Fabric 2.0.0+1.18.2-rc1
flytre_lib: FlytreLib 1.8.2
forgeconfigapiport: Forge Config API Port 3.2.4
com_electronwill_night-config_core: core 3.6.5
com_electronwill_night-config_toml: toml 3.6.5
geckolib3: Geckolib 3.0.79
com_eliotlash_mclib_mclib: mclib 20
goodall: Goodall 1.0.2
ironchests: Iron Chests 1.7.4
libgui: LibGui 5.4.2+1.18.2
jankson: Jankson 4.0.0+j1.2.0
blue_endless_jankson: jankson 1.2.1
libninepatch: LibNinePatch 1.1.0
jade: Jade 5.99.9
java: OpenJDK 64-Bit Server VM 17
journeymap-fabric: Journeymap 5.8.5
journeymap-api-fabric: JourneyMap API 1.18.2-1.8-fabric-SNAPSHOT
linkedstorage: Linked Storage 1.5.1-1.18
lithium: Lithium 0.10.2
minecraft: Minecraft 1.18.2
mob_catcher: Mob Catcher 1.1.30
moderndynamics: Modern Dynamics 0.2.6-beta
naturalist: Naturalist 1.1.1
oxidized: Oxidized 1.6.4
oxidized-armor: Oxidized Armor 1.0.0
peripheralium: Peripheralium 0.4.17-1.18.2
peripheralworks: Unlimited Peripheral Works 0.2.2
piglib: Piglib 1.1.1
pipe: Pipe 1.7.1
polymorph: Polymorph 0.0.21-1.18.2
cardinal-components-base: Cardinal Components API (base) 4.1.4
cardinal-components-block: Cardinal Components API (blocks) 4.1.4
cardinal-components-entity: Cardinal Components API (entities) 4.1.4
cardinal-components-item: Cardinal Components API (items) 4.1.4
reborncore: Reborn Core 5.2.0
repurposed_structures: Repurposed Structures 4.1.15+1.18.2
omega-config: OmegaConfig 1.0.8
roughlyenoughitems: Roughly Enough Items 8.3.571
error_notifier: Error Notifier 1.0.9
ruined_equipment: Ruined Equipment 2.0.0
simple_veinminer: Cyan's Simple Veinminer 1.2.1
completeconfig: CompleteConfig 1.3.3
simplechunkloader: Simple Chunkloader 1.0.1
starterkit-fabric: Starter Kit (Fabric) 3.9
taxfreelevels: Tax Free Levels 1.3.3
techreborn: Tech Reborn 5.2.0
team_reborn_energy: Energy 2.2.0
terrablender: TerraBlender 1.2.0.126
waystones: Waystones 2.5.5+mc1.18.2
wiredredstone: Wired Redstone 0.3.10+1.18.2
graphlib: Graph Lib 0.2.5+1.18.2
libmultipart_deps_container: LibMultiPart (Dependency Container) 0.7.5-pre.0.2+kneelawk
libblockattributes_core: LibBlockAttributes (Core) 0.10.2
libmultipart: LibMultiPart 0.7.5-pre.0.2+kneelawk
libnetworkstack: Lib Network Stack 0.6.3
lmp-compat: LMP Compat 0.1.2+1.18.2
Server Running: true
Player Count: 1 / 20; [class_3222['ShadowFoxNixill'/382710, l='ServerLevel[Stream World 2]', x=196.54, y=68.00, z=106.72]]
Data Packs: vanilla, Fabric Mods, file/Caulcrete1.0.0r18.zip, file/ShadowDen-Compat, file/ShadowDen-Dyes, file/ShadowDen-QoL, file/BabyMobs1.0.0r18-nixmod.zip, file/ShadowDen-Slabs, file/shadowden-computers (incompatible), file/ShadowDen-Redstone
World Generation: Stable
Is Modded: Definitely; Server brand changed to 'fabric'
Type: Dedicated Server (map_server.txt)
Thanks for report, I will look at the problem this week
Okey, that's not what happens, it seems.
Can you please provide more detials, like a screenshot of your setup? Just generic move between 2 item_storages works as expected
I won't be able to do so until next week, but I'll set a reminder to get back to you!
Or I'll completely forget! But I've got it reliably happening again. It might also have something to do with one of the storages being AE2?
The code that's trying to move items is as follows:
local nAE2 = "ae2:energy_cell_2"
local pAE2 = peripheral.wrap(nAE2)
local nCond = "ae2:condenser_0"
local pCond = peripheral.wrap(nCond)
while true do
local items = pAE2.items()
-- Iterate all items, throwing away any amounts in excess of 4,096
for i, v in ipairs(items) do
if v.count > 4096 then
local excess = v.count - 4096
pAE2.pushItem(nCond, v.technicalName, excess % 128)
os.sleep(0.05)
excess = (excess - (excess % 128)) / 128
for n = 1, excess, 128 do
pAE2.pushItem(nCond, v.technicalName, 128)
os.sleep(0.05)
end
end
end
end
If the excess
variable is initially set to a multiple of 128, for example if the network contains 4,224 stone which would be an excess of exactly 128, then pAE2.pushItem(nCond, v.technicalName, excess % 128)
will attempt to move 0 of the item, and it will crash.
I also confirmed that that's the problem by just opening a lua console on the computer and running peripheral.call("ae2:energy_cell_2", "pushItem", "ae2:condenser_0", "minecraft:cobblestone", 0)
. I saw the computer complain of a Java exception but couldn't read it before losing connection because the server crashed.
(The crash can be worked around by just wrapping that line in an if excess % 128 ~= 0
block, but it's my opinion that failing to do so should only cause a program crash, not a server crash.)
In a moment I'll test a couple more things and make another comment.
Oh! It's worth noting I haven't updated anything since initially creating this issue (only just now noticed updates are actually available, my loader doesn't automatically tell me). I'm on 0.2.2 for MC 1.18.2. I'll have a look at later versions to see if it's still there after finding a minimum reproduction of the issue.
For AE2 I believe this still can be the case, so I will take a look
Small update: You also need TechReborn (5.2.0; am about to test with latest everything) with machine blocks that are connected to power. TechReborn is what will actually be blamed for the crash, but it can be reliably triggered by attempting to move 0 items with UPW. (Actually I'm wondering if this needs AE2 now. Might be any storage just as long as TR exists.)
(Edit: AE2 is still necessary for these tests because I can't find any item_storage
s in the other mods involved; TR's stuff is all inventory
s.)
Did a few more tests, including on latest everything (except MC version, that's still 1.18.2). The crash still exists, and it IS specific to AE2 storages and only with TechReborn machines existing in the world.
So, this fixed in 0.2.8 release :) There was actually two combined issues, one is related to TechReborn (actually with anything that can start parallel Transaction) and other one with limits. Should be fine now.