Wither Skeleton Tweaks

Wither Skeleton Tweaks

50M Downloads

Possible tick lag and random console spams

MaxNeedsSnacks opened this issue · 8 comments

commented

Mod version 1.16.1-5.0.0

Over the last couple of days, I've been getting more or less severe tick lag caused in part by a lot of AbstractSkeletonEntity ticking, as you can see in this spark profile here:

https://spark.lucko.me/#cI6vPmXlv8

(period 10 minutes, only ticks over 120ms were recorded)

This also happened to coincide with a lot of lines being spammed in console (we're talking hundreds to thousands at a time) saying something along the lines of [Server] Server thread/WARN Tried to add entity minecraft:skeleton but it was marked as removed already.

After debugging the issue for the last 6-7 hours (really I just used a mixin in Skeleton entity to save which method removed it when it's being removed and then print those culprits when the server tries to add it anyways) I've come to the conclusion that both of these issues are most likely interlinked and related to WitherSkeletonTweaks running on the server, more specifically shadows.wstweaks.WSTEvents.witherTransform in WSTEvents. If you want to, I can share the full logs as well as my exact methodology if needed (again, pretty much just printing stack trace and then looking for what called "remove" at an inappropriate time) ^^

commented

Actually, just for reference, here's the full log, you'll definitely start to see it around ll. 10000 and onward

latest.log

commented

This might be a forge bug, the docs of SpecialSpawn explicitly state that If this event is canceled, the Entity is not spawned.
However, the only thing the cancellation result of SpecialSpawn prevents is the call to MobEntity#onInitialSpawn.
I fail to see how that would correlate with excessive tick lag, however. Obviously the log spam is bad, but the tick issue is likely unrelated as the entities are never added to the world when that log exception is printed (and if the logging were lagging the server, the tick time wouldn't be pointing to skeletons).

commented

Regardless of what the docs say this is an effective way of preventing the log spam, so that can be employed instead.

commented

Thanks for the quick fix! As for the tickrate issue, I‘m not ENTIRELY sure what causes it unfortunately, but I‘ll have a look around and see what else modifies skeletons / wither skeletons in the pack (as well as check how the tickrate fares with WST having been removed temporarily). If I find anything of value, I‘ll let you know, but honestly, I fear this COULD just be the result of the faulty vanilla mob AI (or faulty things done to already suboptimal AI code)

commented

That said, actually, the fact that the added after removed log appeared in such copious amounts might point towards wither skeleton spawn rates being too high in the pack perhaps, since these warnings appear hundreds at a time and there SHOULDN‘T be hundreds of skeletons trying to spawn in a manner of seconds

commented

Also after sitting there trying to spam trigger that code path, I barely got it to trigger, because natural spawn rates for normal skeletons have been heavily reduced in 1.16 as compared to previous version (but it's still higher than 0).

However, that event is fired for spawners, so perhaps there's a skeleton spawner (or a lot) loaded somewhere in the nether?

commented

Honestly, after checking again most of the tick lag is happening in the OW, so I'm assuming there are a bunch of Skeleton Spawners doing all sorts of shenanigans there? We do have Apo installed technically but I've never had problems with that thus far

commented

The skeleton spawners in the OW also should not trigger this code path unless you have it enabled for WST to trigger in non-nether dimensions. In the event that you have, it's possible that there are some in the OW, but it's defaultly off.