Closed StevenH237 closed 1 year ago
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.
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.