IntelligenceModding / AdvancedPeripherals

Advanced Peripherals adds many new features to the computercraft modification

Home Page:https://advancedperipherals.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RSBridge hangs server when attempting to use exportItem or exportItemToPeripheral to move a specific item with NBT data.

Negitive545 opened this issue · comments

Describe

When attempting to move a certain item(s) using the RSbridge functions exportItem or exportItemToPeripheral, the server will hang for 60 seconds and then crash due to that.

I have been unable to identify what item is causing the problem, but I know it has non-nil NBT data.

Possible Fingerprint/Hash issue?

Pastebin to the script I'm using that causes the issue in case it's just a problem of garbage code: https://pastebin.com/TcTSrCtH

Steps to reproduce

  1. Connect a computer to an RS Network using the RSBridge
  2. Attempt to move an item with NBT data using exportItem() or exportItemToPeripheral()
  3. Server hangs, then crashes.

Multiplayer?

Yes

Version

1.20.1-0.7.38r (Latest 1.20.1)

Minecraft, Forge and maybe other related mods versions

Minecraft 1.20.1, Forge 47.2.19, CC:Tweaked 1.109.6, ATM9 0.2.51

Screenshots or Videos

No response

Crashlog/log

https://pastebin.com/zNvYKCZ4

The filter that you're applying contains a fingerprint
the bridge then searches for the item with the fingerprint, that's where it seems to freeze
I don't think that it's mainly caused by AP since we don't use regex at all, and I never changed how we generate and compare the fingerprint. It seems that there is a bug in minecraft, forge or a mod conflict

Would you be able to test that with neoforge and/or only with AP and Refined Storage?

I will check that more intense later

I can certainly try to test things, but it'll be difficult since I don't know what item/fingerprint is causing the freezes. Glad to hear it's probably not AP, but also unfortunate that the problem won't be an easy solve.

Will report back if I'm able to test on Neo or with only AP and RS

Update: I've been unable to attempt this in Neoforged due to server incompatibility.

Also, I've identified that the problem is NOT with any specific item, it appears to be able to happen randomly to any given item, I've had some attempts that go for 6-7 items before hanging, and others that hang on the first item moved. I've been using my script to "scout" what items are going to be moved first by commenting out the actual export part, and it seems that the item that it hangs on is random, sometimes it's a map, sometimes it's an ars nouveau spellbook, etc.

One strange thing I saw was that I ran the scout command, it gave me a list, I then ran the exporting part and successfully "moved" 5-6 items, but when I checked my barrels they weren't there, so I scouted again and got the same list, but then when I tried to export them it crashed on the first attempt. Here's a pastebin for the crashlog of that specific attempt in case there's useful info in there: https://pastebin.com/EAdwzENf

The more I investigate the more likely it seems this is an issue baked into forge, which makes me sad cause I can't upgrade to Neoforged to solve the problem due to the aforementioned incompatibilities.

I was unable to test that in my environment, I assume it's a conflict or a forge issue

The thing you can do as a workaround is removing the fingerprint tag from the filter, so AP does not try to search for the fingerprint

    for x, item in pairs(filteredList) do
        print(item.fingerprint)
        -- Remove fingerprint but keep nbt
        item.fingerprint = nil 
        print(item.fingerprint)
        RSBridge.exportItem(item, "top")
        print("Moved "..item.displayName.." to Deep Storage.")
        sleep(5)
    end

Thanks for the help! I'll close this now since it's clearly a forge issue (I don't think it's a mod compat issue due to the inconsistency of which items cause the crashing), and that issue will likely be fixed (or has already been fixed) for Neoforged

If anyone in the future has this same issue, the solution is found above.