StackOverflowError (recursion on ExperienceOrb.java:222)
Tander opened this issue ยท 3 comments
Describe the bug
Sometimes (not always), when a player with enchanted gear picks up an experience orb, he causes Exception and getting kicked from server (Internal Server Error). After it he can't rejoin until all orbs will be gone. Reloading server is also helps. We tried to remove items with enchantments from erroring players, but got inconsistent results so far.
Versions
- Forbidden & Arcanus: forbidden_arcanus-1.18.2-2.1.0-beta2.jar
- Valhelsia Core: valhelsia_core-1.18.2-0.3.1.jar
- Forge: 40.1.54
- Apotheosis-1.18.2-5.3.6.jar (and other mods, full list below)
Additional context
Here what we get in console:
[11:50:50] [Server thread/WARN]: Failed to handle packet for /
net.minecraft.ReportedException: Ticking player
at net.minecraft.server.level.ServerPlayer.m_9240_(ServerPlayer.java:502) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.m_9933_(ServerGamePacketListenerImpl.java:207) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.network.Connection.m_129483_(Connection.java:245) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:142) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:916) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:326) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:842) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:685) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:261) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.StackOverflowError
at java.util.HashMap.putVal(Unknown Source) ~[?:?]
at java.util.HashMap.putMapEntries(Unknown Source) ~[?:?]
at java.util.HashMap.(Unknown Source) ~[?:?]
at com.google.common.collect.Maps.newHashMap(Maps.java:258) ~[guava-31.0.1-jre.jar%2321!/:?]
at net.minecraft.nbt.CompoundTag.m_6426_(CompoundTag.java:426) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.nbt.CompoundTag.m_6426_(CompoundTag.java:22) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at com.google.common.collect.Iterators$6.transform(Iterators.java:826) ~[guava-31.0.1-jre.jar%2321!/:?]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52) ~[guava-31.0.1-jre.jar%2321!/:?]
at com.google.common.collect.Iterators.addAll(Iterators.java:367) ~[guava-31.0.1-jre.jar%2321!/:?]
at com.google.common.collect.Lists.newArrayList(Lists.java:147) ~[guava-31.0.1-jre.jar%2321!/:?]
at com.google.common.collect.Lists.newArrayList(Lists.java:133) ~[guava-31.0.1-jre.jar%2321!/:?]
at net.minecraft.nbt.ListTag.m_6426_(ListTag.java:314) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.nbt.ListTag.m_6426_(ListTag.java:12) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at com.google.common.collect.Maps$9.transformEntry(Maps.java:2053) ~[guava-31.0.1-jre.jar%2321!/:?]
at com.google.common.collect.Maps$12.getValue(Maps.java:2101) ~[guava-31.0.1-jre.jar%2321!/:?]
at java.util.HashMap.putMapEntries(Unknown Source) ~[?:?]
at java.util.HashMap.(Unknown Source) ~[?:?]
at com.google.common.collect.Maps.newHashMap(Maps.java:258) ~[guava-31.0.1-jre.jar%2321!/:?]
at net.minecraft.nbt.CompoundTag.m_6426_(CompoundTag.java:426) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.item.ItemStack.m_41777_(ItemStack.java:407) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.item.ItemStack.handler$zel000$forbiddenArcanus_isDamageableItem(ItemStack.java:1600) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.item.ItemStack.m_41763_(ItemStack.java:284) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.item.ItemStack.m_41768_(ItemStack.java:292) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.item.enchantment.EnchantmentHelper.m_44839_(EnchantmentHelper.java:290) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.entity.ExperienceOrb.m_147092_(ExperienceOrb.java:222) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.entity.ExperienceOrb.m_147092_(ExperienceOrb.java:228) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.entity.ExperienceOrb.m_147092_(ExperienceOrb.java:228) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
at net.minecraft.world.entity.ExperienceOrb.m_147092_(ExperienceOrb.java:228) ~[server-1.18.2-20220404.173914-srg.jar%23142!/:?]
(... e.t.c)
Because of forbiddenArcanus_isDamageableItem
is only modded line in the stacktrace I suspect your mod may cause it
Any help with troubleshooting will be appreciated
Modpack is https://www.curseforge.com/minecraft/modpacks/elittle-dragon-expedition
I believe this is an interaction with Clumps.
I've had two reports of this so far:
jaredlll08/Clumps#103
jaredlll08/Clumps#106
With no reports of it not mentioning forbidden arcanus.
I believe the issue has to do with this line:
https://github.com/stal111/Forbidden-Arcanus/blob/1.18/src/main/java/com/stal111/forbidden_arcanus/core/mixin/ItemStackMixin.java#L24
From what I can tell, you are needlessly copying the ItemStack, which is a rather expensive call as it deep copies all the NBT as well.
The method you call (https://github.com/stal111/Forbidden-Arcanus/blob/1.18/src/main/java/com/stal111/forbidden_arcanus/common/item/modifier/ModifierHelper.java#L21) doesn't change anything about the ItemStack, so you don't need to copy the stack before calling it.
Thanks for letting me know. The copying was indeed completely unnecessary, not sure why I decided to do it that way in the first place.
Fixed version should be out in a few hours probably.
Just wanted to update you, the issue was actually in clumps itself (jaredlll08/Clumps#107) (or rather vanilla code that doesn't affect them), so it had nothing to do with your mod, but the copy was still not ideal.