Ars Nouveau

Ars Nouveau

70M Downloads

Crash using Enchanter's Bow (Part 2)

TigerWalts opened this issue ยท 1 comments

commented

The initial issue was raised her and a commit was made to attempt a fix but I do not think it worked.

I have dug into this and this is my understanding:

Mods (ATM 10 : 4.5)

  • Ars Nouveau 5.10.2
  • Curios API 9.5.1+1.21.1

Details

  • As part of Ars' spell handling it tries to get the arrow shooter's Curios slots
  • Curios' API for this needs to access the shooter entity's level field which it finds to be null and this causes the crash
  • Ars has code to add a FakePlayer as the shooter if the shooter is null and this FakePlayer gets given the same level that the arrow is in
    • This tells us that the shooter is not null before the spell handler is run, but it has a null level

Somehow the shooter entity attached to the arrow either has no level set or the level is being set to null at some point along the chain.

I suspect that the level on the shooter (a player) is null because the player has been partially spawned. The player entity exists but has not yet been spawned in the world and so the player entity's world field is null.

So this crash can only be triggered by a player's arrow hitting something on the same tick that the player re-joins.

This means that the player left the server just before that tick and the world saved that state - The odds of this happening in open play is close to impossible. So there must have been a crash at that point to force this state.

Digging through the crash reports on a server that had this issue. I found this timeout crash before all the re-join crashes:

Description: Watching Server

java.lang.Error: ServerHangWatchdog detected that a single server tick took 120000008.00 seconds (should be max 0.05)
	at java.base/java.util.ImmutableCollections$SetN.probe(ImmutableCollections.java:1024) ~[?:?] {}
	at java.base/java.util.ImmutableCollections$SetN.contains(ImmutableCollections.java:945) ~[?:?] {}
	at TRANSFORMER/[email protected]/net.minecraft.core.Holder$Reference.is(Holder.java:169) ~[server-1.21.1-20240808.144430-srg.jar%23546!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:supermartijn642corelib.mixins.json:HolderReferenceMixin from mod supermartijn642corelib,pl:mixin:APP:lithostitched.mixins.json:common.HolderReferenceAccessor from mod lithostitched,pl:mixin:APP:owo.mixins.json:registry.ReferenceAccessor from mod owo,pl:mixin:A}
	at TRANSFORMER/[email protected]/net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.is(MixinBlockStateBase.java:806) ~[server-1.21.1-20240808.144430-srg.jar%23546!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:modernfix-common.mixins.json:bugfix.chunk_deadlock.BlockStateBaseMixin from mod modernfix,pl:mixin:APP:modernfix-common.mixins.json:perf.reduce_blockstate_cache_rebuilds.BlockStateBaseMixin from mod modernfix,pl:mixin:APP:xycraft_core.mixins.json:BlockBehaviourEventMixin from mod xycraft_core,pl:mixin:APP:ferritecore.blockstatecache.mixin.json:BlockStateBaseMixin from mod ferritecore,pl:mixin:APP:mekanismcovers.mixins.json:BlockStateBaseMixin from mod mekanismcovers,pl:mixin:APP:immersiveengineering.mixins.json:coremods.AbstractBlockStateMixin from mod immersiveengineering,pl:mixin:APP:mixins.integrateddynamics.json:MixinBlockStateBase from mod integrateddynamics,pl:mixin:APP:ars_nouveau.mixins.json:redstone.RedstoneLevelMixin from mod ars_nouveau,pl:mixin:APP:kubejs.mixins.json:BlockStateBaseMixin from mod kubejs,pl:mixin:APP:framedblocks.mixin.json:MixinBlockStateBase from mod framedblocks,pl:mixin:APP:modern_industrialization.mixins.json:BlockStateBaseMixin from mod modern_industrialization,pl:mixin:APP:expandability-common.mixins.json:fluidcollision.BlockStateBaseMixin from mod expandability,pl:mixin:A}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.entities.BeeAggression.minedBlockAnger(BeeAggression.java:76) ~[the_bumblezone-7.10.0+1.21.1-neoforge.jar%23928!/:?] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.Bumblezone$$Lambda/0x00007f380d4fe640.apply(Unknown Source) ~[?:?] {}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.events.base.CancellableEventHandler.lambda$addListener$0(CancellableEventHandler.java:21) ~[the_bumblezone-7.10.0+1.21.1-neoforge.jar%23928!/:?] {re:classloading}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.events.base.CancellableEventHandler$$Lambda/0x00007f380d4ff0d0.apply(Unknown Source) ~[?:?] {}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.events.base.CancellableEventHandler.invoke(CancellableEventHandler.java:45) ~[the_bumblezone-7.10.0+1.21.1-neoforge.jar%23928!/:?] {re:classloading}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.neoforge.NeoForgeEventManager.onBlockBreak(NeoForgeEventManager.java:281) ~[the_bumblezone-7.10.0+1.21.1-neoforge.jar%23928!/:?] {re:classloading}
	at TRANSFORMER/[email protected]+1.21.1-neoforge/com.telepathicgrunt.the_bumblezone.neoforge.NeoForgeEventManager$$Lambda/0x00007f380dfcf948.accept(Unknown Source) ~[?:?] {}
	at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.ConsumerEventHandler$WithPredicate.invoke(ConsumerEventHandler.java:48) ~[bus-8.0.5.jar%2362!/:?] {}
	at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:360) ~[bus-8.0.5.jar%2362!/:?] {}
	at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:328) ~[bus-8.0.5.jar%2362!/:?] {}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.util.ANEventBus.post(ANEventBus.java:13) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.util.BlockUtil.destroyRespectsClaim(BlockUtil.java:105) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.common.spell.effect.EffectBreak.onResolveBlock(EffectBreak.java:79) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading,pl:mixin:A}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.AbstractEffect.onResolve(AbstractEffect.java:57) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:computing_frames,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.resume(SpellResolver.java:243) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.resolveAllEffects(SpellResolver.java:188) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.onResolveEffect(SpellResolver.java:177) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.common.spell.effect.EffectBurst.makeSphere(EffectBurst.java:68) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.common.spell.effect.EffectBurst.onResolveBlock(EffectBurst.java:46) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.AbstractEffect.onResolve(AbstractEffect.java:57) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:computing_frames,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.resume(SpellResolver.java:243) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.resolveAllEffects(SpellResolver.java:188) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.api.spell.SpellResolver.onResolveEffect(SpellResolver.java:177) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:mixin,re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.common.entity.EntitySpellArrow.onHit(EntitySpellArrow.java:339) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:classloading}
	at TRANSFORMER/[email protected]/com.hollingsworth.arsnouveau.common.entity.EntitySpellArrow.tick(EntitySpellArrow.java:168) ~[ars_nouveau-1.21.1-5.10.0.jar%23589!/:5.10.0] {re:classloading}

Not sure exactly why this timeout happened but this crash explains how we got into the state of an arrow being 1 tick away from hitting something.

I think the easiest resolution would be for Ars to check that not only is a shooter attached to the arrow but that the shooter has a level set also. Maybe set it to the arrow's world as a fallback.

This will not prevent the instigating crash. In fact the instigating crash will most likely happen again. But now we will be getting that crash report each time and attention can be directed towards that and not this crash.

commented

This should be resolved in 5.10.3.