Integrated Terminals

Integrated Terminals

20M Downloads

"Tried to read NBT tag that was too big" with large numbers of crafting recipes

Mike-Baker opened this issue ยท 8 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

NBT size error with large numbers of crafting recipes (~220 in my world but it will likely vary based on recipe size?)

Symptoms:

  • Adding an additional crafting recipe over some number will cause no crafting recipes to show up in the terminal.
  • Crafting writers still function and automate crafts
  • Error shows up in the logs (although it is fairly opaque)

Mitigation:

  • Moving some crafting recipes into a crafter on a different channel to go back bellow the number will fix the issue

Additional Errors:
If you have one "overloaded" channel and one working channel, filtering the terminal to just the overloaded channel will show nothing, filtering it to the working channel will show the working recipes however filtering it to "all" will result in the results of the working channel endlessly cloned again and again and again

Diagnosis:
With help from kirjorjos and Natalie in your discord we came to the tentative conclusion that the issue is that all the NBT data for a channel's crafting recipes is serialised into one CompoundTag NBT object which then fails serialisation? deserialisation? at some point.
Regrettably I wasn't able to isolate where this happens in the code myself but I can provide more details, screenshots and/or a save file if that would help?

Steps to reproduce the problem:

  1. Create a large number of crafting interfaces, and fill them with a large number of recipes (~220)
  2. Try to open the storage terminal
  3. Observe no recipes present
  4. Remove some recpies/interfaces
  5. Remaining recipes re-appear in the terminal

Expected behaviour:

All recipes visible in storage terminal


Versions:

  • This mod: 1.8.18
  • Minecraft: 1.19/2
  • Forge: Unsure

Log file:

https://pastebin.com/nK2gafAZ

commented

Best to leave the issue open for now indeed.

Thanks for the kind words! :-)

commented

@Mike-Baker Your issue appears to be not following one of the allowed issue templates, which breaks our automation tools. Please update your issue to the proper template.

commented

In any case, the relevant part of the code is here:

private void sendCraftingOptionsToClient(int channel, List<HandlerWrappedTerminalCraftingOption<T>> channeledCraftingOptions,
boolean reset, boolean firstChannel) {

Could you try lowering terminalStoragePacketMaxInstances in your config file, to see if that resolves your problem? We may have to lowering that value by default. (or we may have to add a dedicated option for crafting instances specifically, since crafting and storage instances currently both make use of this option, while the former is significantly larger NBT-wise)

commented

I have updated the issue text so it should conform to the right template now.

commented

Thanks!

commented

Dropping terminalStoragePacketMaxInstances from 1024 to 512 didn't help neither did 256, but dropping it to 128 seemed to fix the issue. (which makes sense given my network was blowing up at 220 recipes)

This does imply that the average recipe in my world takes around 10 kilobytes, I don't know if that's an abnormal case or if you could use it as a heuristic for finding the correct value.

commented

Thanks for checking!

Will look into adding a separate config option then for crafting instances, with the default set to 128 or so.

commented

Thanks for the super quick reply and fix ๐Ÿ‘

I will leave this open in-case you want to use it to track the updated config, but otherwise I want to say that your code is very nicely structured and I have been really enjoying the integrated suite of mods!