mojira.dev
MC-182325

Iron golem causes lag when it can't attack its enemies

The bug

When an Iron Golem is caged with line of sight to the target mob but can't attack due to blocks being in the way it creates large amounts of server lag.

Attached in a video of the bug, 1st part is the lag subsiding after kill the iron golem, the second part is the lag subsiding after killing the pillagers.

Video

[media]

Linked issues

Attachments

Comments 13

It does not look like your fps changes significantly. How does this bug affect you?

Once the TPS gets into the red as shown in the video mob movements becomes jittery and almost non existent, yes my FPS is fine and I'm able to move around the area but I'm no longer able to interact with my surroundings. 

Thommy Siverman

Though I'm seeing more of an fps-drop (from 60 to ~45-50) than a tps-drop using this repro, it definitely affects performance.

Iosiv Visokogorskiy

Affects 1.16 pre release 2

@unknown would you mind uploading your world?

I've failed to reproduce this on 20w18a snapshot even using the exact same cage you built and with both less and more combinations of golems / pillagers.

3 more comments

Hi, sorry for the delay in reply, had to return to work and not been able to check messages.

I've attached the world file generated in 1.16 Pre-Release 5 (latest as of posting) and still experiencing the bug.

Did a few tests myself and it would seem that the issue does lie with the Golem as the spikes only start to happen once the iron golem takes notices of the Pillagers, while the pillagers are just trying to attack the golem but before it notices them there are no spikes but as soon as the iron golem starts to track one of the pillagers but can't attack them the spikes start to go up.

[media]



Here is a screenshot of the issue just before I exited the game and saved it to attach here:

[media]

If it's at all helpful my system specs are:

  • AMD Fx 8350 @ 3.51GHz

  • Sapphire Nitro+ RX 590 8GB

  • 24GB DDR3 Ram

Using the latest MC launcher and latest snapshot (pre-release) version

As a test that it wasn't my system at fault, I opened the world on a second PC and this was the result after summoning 10 or 12 pillagers, the spike started once again after the iron golem registered the pillager but couldn't attack

[media]

Awesome, will take a look at this today. Thanks for your report!

So I think I got the hang of this. Apparently the pillagers doesn't see the Iron Golem through the fence which in itself is a bit of problem. They could obviously see it at some point in time, otherwise they would not be able to obtain their target.
What this leads to is constant pathfinding trying to get closer to the golem every tick causing the lag.

The quick fix to this is to limit the number of path updates, but in the long run we'd also like to take a look at both the Pillager AI here as well as why they can't see through the fences.

Thanks @unknown for the detailed report and sending your world!

That problem could also relate to MC-64370

The8BitMonkey

billysjoberg

Confirmed

Important

Performance

20w18a, 1.16 Pre-release 5

1.16 Pre-release 6

Retrieved