Integrated Dynamics

Integrated Dynamics

63M Downloads

[Bug]: Integrated Crafting in 1.16.5 causes server to freeze when autocrafting. Cross mod interaction possible.

Raidobw2 opened this issue ยท 9 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

AutoCraft in Integrated Dynamics creates a deadlock on the server side at this line
Or this line
Also, you can checkout All stacks from the JVM.
Something wrong with this, when you try to get from CacheStorage:

    private final LoadingCache<PartPos, IIngredientComponentStorage<T, M>> cacheStorage;
    ...
    this.cacheStorage = CacheBuilder.newBuilder()
                .build(new CacheLoader<PartPos, IIngredientComponentStorage<T, M>>() {
            public IIngredientComponentStorage<T, M> load(PartPos pos) {
                IIngredientComponentStorage<T, M> storage = getPositionedStorageUnsafe(pos);
                return storage == null ? new IngredientComponentStorageEmpty<>(getComponent()) : storage;
            }
        });
   ...
   this.cacheStorage.get(pos);

I was able to reproduce it only in the OceanBlock pack.

With this mods in list I can't reproduce it:

Integrated-Tunnels-Compat 1.8.9
IntegratedTerminals 1.2.11
IntegratedTerminalsCompat 1.2.11
IntegratedDynamics 1.10.6
IntegratedDynamics-Compat 1.10.6  
Integrated NBT
IntegratedCrafting 1.0.20
Cyclops Core 1.12.1
CommonCapabilities 2.8.0
Lollipop 3.2.9
Krate 0.1.4
CreativeCore 2.0.0
JEI 7.7.1.128
Forge 36.2.20
CoFH core 1.4.0.6
JEI Integration 7.0.1.15
TrayLauncher 1.0
CodeChicken Lib 4.0.5.438
ConnectedTexturesMod MC1.16.1-1.1.2.6
CraftingTweaks 12.2.1

Steps to reproduce the problem:

I use FTB OceanBlock, I tried to reproduce it with only IntegratedDynamics and Krate and the bug does not occur. Here are the steps to reproduce:

  1. Setup 2 chests, 1 crafting table.
  2. Connect chests with tunnels and item interface
  3. Connect crafting table with crafting interface
  4. Create recipes for "Krates" (again, it shouldn't be related only for them, but haven't tried yet)
  5. Start auto craft for any of them.
  6. Sometimes it goes stuck not after the first try, but it could take 1-2-5-10 times before the deadlock.

Expected behavior:

To see the Screen with Crafting Plan, not the server DeadLock


Versions:

  • Minecraft: 1.16.5
  • Forge: 36.2.20
  • CyclopsCore: CyclopsCore-1.16.5-1.12.1.jar
  • IntegratedDynamics: IntegratedDynamics-1.16.5-1.10.6.jar
  • IntegratedCrafting: IntegratedCrafting-1.16.5-1.0.20.jar
  • IntegratedTerminals: IntegratedTerminals-1.16.5-1.2.11.jar
  • IntegratedTunnels: IntegratedTunnels-1.16.5-1.8.9.jar

Additional information:

https://youtu.be/s4K5ZOwFa6I?t=280 => Relayed from FTBTeam/FTB-Modpack-Issues#520.
https://youtu.be/UwVeBYYL2QA?t=150 => Relayed from FTBTeam/FTB-Modpack-Issues#512.

https://gist.github.com/libbkmz/3820ecd8450ffc11d929b23909d5ebbe - Stack trace captured after getting deadlock via jstack PID.

Original error on #1111 linked from FTBTeam/FTB-Modpack-Issues#346.

The user from the current issue this is being reported from, on FTB Modpack Issues, left this message:

What should I do in the meanwhile? I can help to do something, to speed up it.
Btw, found that Guava's Cache is prone to deadlocks. =\

They can interact in here to help you, or if you have any questions feel free to ask me directly.
I can also reproduce the issue upon request, or if you need to pin down a potential problem -- I'm available.

Thank you very much for your time!

commented

Thanks for reporting!

commented

Note to self: this seems to be an issue in Integrated Terminals running in another thread, related to the change in ee8e836. We probably want to remove the call to TileHelpers.getWorldTileEntityUnchecked there.

commented

If you need to test builds at some point let me know I'll be happy to give a helping hand :)

commented

Will do, thanks!

commented

Yeap, you can also reach out to me for any help with that issue.

commented

Yeah, looks like it's working with that setting disabled.

commented

Ok, I'll probably just disable multithreaded crafting planning by default, it's causing too many issues that are not easily fixable in MC's architecture.

@Raidobw2 @libbkmz Could you check if setting craftingPlannerEnableMultithreading to false in the Integrated Terminals config solves all your problems? Hopefully, it should not result in too large a performance degradation.

If someone confirms that this works well, I'll make craftingPlannerEnableMultithreading default to false.

commented

Thanks for checking, will prepare a new release in a bit.

commented

Thank you both! :)