Description

Entities pathfind processing can make servers falling behind under some circumstances. This has especially observed with pillagers, but also with zombies. Every time, killing the said entities solves issue.

First time this has been observed with pillagers: with a dozen of villages loaded (breeder, iron farms). Pillagers can never reach the villages, and start running around, dancing, looking in all directions. And consistent lag starts to build up until you kill the pillagers. Lag can start with only 10 pillagers, and is worsened resulting in chunks not loading once you reach 100 pillagers. Killing all the pillagers immediately solves this issue and server is running smoothly again.

Second time this has been observed with zombies under a strange configuration with lightning not updating near torches (screenshots). This repetitively caused server crashing upon exceeding maximum tick delay. Once again, killing the zombies solved the issue.

Having a profiling running, it appears that

*.newAi.goalSelector.goalTick.pathfind

is taking too long to proceed and makes the server falling behind or crashing. In both situations, the mobs were trying to reach an unreachable goal (either vilages or player).