Thaumcraft Fix

Thaumcraft Fix

23.3k Downloads

Extreme lag when scanning some blocks with Thaumometer and checking some items aspects by holding shift

mczph opened this issue ยท 8 comments

commented

I didn't get any crash or error from ThaumcraftFix iteself,but when ThaumicJEI is caching item aspects,there are spams in my logs look like this related to both ThaumcraftFix and ThaumicRestoration(The above are some normal logs and below are the error messages)

[17:00:30] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 67%
[17:00:35] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 67%
[17:00:40] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 67%
[17:00:45] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 67%
[17:00:50] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 67%
[17:00:55] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 68%
[17:01:00] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 68%
[17:01:05] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 68%
[17:01:10] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 69%
[17:01:15] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 69%
[17:01:20] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 70%
[17:01:25] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 70%
[17:01:30] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 70%
[17:01:35] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 71%
[17:01:40] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 71%
[17:01:45] [ThaumicJEI Aspect Cache/INFO] [thaumicjei]: ItemStack Aspect checking at 71%
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: java.lang.ArrayIndexOutOfBoundsException: 0
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at com.Zoko061602.ThaumicRestoration.crafting.recipe.RecipeCrystal.func_77569_a(RecipeCrystal.java:26)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thecodex6824.thaumcraftfix.core.transformer.MiscTransformers$Hooks.createFilledInventoryForRecipe(MiscTransformers.java:122)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getAspectsFromIngredients(ThaumcraftCraftingManager.java:550)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromCraftingRecipes(ThaumcraftCraftingManager.java:514)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTagsFromRecipes(ThaumcraftCraftingManager.java:604)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.generateTags(ThaumcraftCraftingManager.java:425)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getObjectTags(ThaumcraftCraftingManager.java:179)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.crafting.ThaumcraftCraftingManager.getObjectTags(ThaumcraftCraftingManager.java:143)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.common.lib.InternalMethodHandler.getObjectAspects(InternalMethodHandler.java:86)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.api.aspects.AspectHelper.getObjectAspects(AspectHelper.java:69)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at thaumcraft.api.aspects.AspectList.<init>(AspectList.java:21)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at com.buuz135.thaumicjei.ThaumcraftJEIPlugin.createAspectsFile(ThaumcraftJEIPlugin.java:224)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at com.buuz135.thaumicjei.ThaumcraftJEIPlugin.lambda$register$3(ThaumcraftJEIPlugin.java:134)
[17:01:49] [ThaumicJEI Aspect Cache/INFO] [STDERR]: [thaumcraft.common.lib.crafting.ThaumcraftCraftingManager:generateTagsFromCraftingRecipes:529]: 	at java.lang.Thread.run(Thread.java:750)
commented

This happens because we started verifying that recipes match their inputs when determining aspects, but that recipe relies on knowing aspects of its ingredients to function at all. This is another problem related to the way the aspect registry currently works, as it currently doesn't take dependencies between recipes into account (see #32 with the shulker box and chest example). In the meantime, I'll add some extra checks to stop things from crashing if things go wrong.

commented

I tested with the latest version and found that the lag issue was not resolved. After testing, I found that this happens on some specific mod blocks and only requires Thaumcraft and ThaumcraftFix to reproduce. This is manifested as continuous spikes in latency, and the situation deteriorates to freezing in the modpack environment.
image

commented

Actually fixed!Will test it in a bigger instance later.

commented

Just to clarify, were you testing with the (currently unreleased) v1.0.3? That commit is not in any of the versions on CurseForge at the moment, since I wanted to do some testing. If you weren't using it, you can grab it from the actions build until I release it.

If you were using 1.0.3, did you scan the ME controller you were looking at in the screenshot? If not, does the lag get better after you scan it? What about if you also scan the nearby blocks, so nothing that was needs to be scanned is near it? If you know how to use VisualVM or some other profiling tool, you can skip all of that and send me CPU sampling results of the client thread. When I just tested it with 1.0.3, I saw the existence of some scanner code that generated aspect tags, but it only ran at the very beginning and not repeatedly.

commented

@TheCodex6824 Can confirm this occurs with the latest Actions build, here's a screenshot from VisualVM:
image
It seems to get worse with more mods installed, but even with only Thaumcraft, Thaumcraft Fix and AE2 - it continuously lags.

Edit: (to put the correct screenshot, and) to be more specific, the lag does continue after scanning it.

commented
commented

Figured it out - this happens when something has no aspects, due to one of the fixes in this mod for the snow issue from #8. The whole point of that fix is to not add things with no aspects to the registry to avoid it being chosen over other metadata options. I have to tweak that to actually register something so it doesn't scan all of the recipes in the game every tick. Thank you both for your help!

commented

Try the latest build - this will hopefully stop the lag issues while still fixing the original issue.