mojira.dev
MC-134696

Cod AI performance issue

The bug

It appears that minecraft:cod AI has a memory leak and it affects performance.

Linked issues

Attachments

Comments

migrated

Confirming that this happens on two servers a friend of mine and I own.

It is keeping the CPU at 100%, players and mobs start experiencing extreme rubber band movement.

Server specs:

  • Server 1

    • Host: self-hosted on a VPS 

    • CPU: Intel Xeon D-1531 @ 2.199 GHz

    • RAM: 8 GB

  • Server 2

    • Host: https://vahosting.net - Premium Grass plan 

    • CPU: Intel i7-4790K, 4 cores/8 threads @ 4.0/4.4 GHz

    • RAM: 2 GB

See attached the debug profiler's output from the two servers mentioned above and notice the bolded values:

filename

T/s

path to entity

% of process(or) usage

s1_profile-results-2018-07-29_16.00.47.txt

8.83

levels > world > tick > entities > regular > tick > minecraft:cod

87.72% / 67.05%

s1_profile-results-2018-07-29_16.16.26.txt

16.78

levels > world > tick > entities > regular > tick > minecraft:cod

77.87% / 42.01%

s2_profile-results-2018-07-29_10.54.33.txt

6.86

levels > world > tick > entities > regular > tick > minecraft:cod

96.32% / 80.57%

s2_profile-results-2018-07-29_13.10.03.txt

14.67

levels > world > tick > entities > regular > tick > minecraft:cod

81.87% / 57.42%

The threads dealing with the cod (mostly the ai > newAi) are taking up the majority of the CPU time.

migrated

Problem still occurs with snapshot 18w31a. Please see attached s2_18w31a_profile-results-2018-08-01_16.58.40.txt

minecraft:cod is taking up 50.11% of CPU time, of which 41.04% is its ai > newAi > goalSelector.

In comparison zombie takes up less than 2%, so is the skeleton, creeper and any other entity. Putting it other way, the cod's logic alone is taking up equally as much as all other entities ingame combined!

@Brian Rivas can you please add 18w31a to the affected versions?

migrated

Resolving this as duplicate seems wrong to me - this and MC-91621 are two separate problems that just happen to interact in an unfortunate way to lead to the particularly nasty lag that Hermitcraft and others are seeing in 1.13.1. This bug is that the fish-specific AI routine is excessively slow, which would still be a problem even if MC-91621 were fixed. MC-91621 is about ALL mobs, not just fish, constantly spawning and despawning, which always causes lag even when there's nothing wrong with the AI of the mobs in question.

migrated

You're welcome, but maybe calling the mods incompetent isn't the best way to get them to want to be helpful? Regardless I hope they'll revisit both this issue and MC-91621. Considering that Hermitcraft is so high profile I'm surprised that this isn't getting more priority from Mojang, honestly.

EarlyReflections

This bug with the Cod AI is new to 1.13.x, and is a critical issue. It breaks the game. It's not a duplicate of MC-91621, which is 3 years old. Bugs this critical usually get fixed quickly because they're game-breaking. MC-91621 is not critical, it managed to live happily for 3 years, unassigned.

One of my friends on my server has a mob farm high up over an ocean and we can't go anywhere near it without bringing the server down its knees. 

Please reopen this critical issue. 

migrated

Ok so any of the devs wanna look into this? 

1.13 is a disaster when looking into its performance yet no one seems to care. Do we need to start making more fuss about this hoping you're gonna solve it?

migrated

@neko Please read the comments and consider reopening MC-134696; it is not a duplicate of the bug you marked it a duplicate of.

marcono1234

@@unknown, what @unknown wrote is right. Calling us incompetent won't help, neither you nor us. This report here is not the only report on the bug tracker and it can happen that we miss comments on reports, especially since we helpers and moderators are volunteers and do this in our free time.

In general please create a post in /r/Mojira in this case. There we will see the problem and additionally can discuss it if necessary.

violine1101

In fact, based on my testing in several buffet worlds, not only cods have this problem, but other fish like salmon also have a significant share of the debug profile if the biome of the buffet world allows those types of fish to spawn (for example, Cold Ocean). Cod just spawn way more often than other types of fish, hence they also have a bigger share in the debug profile. Based on this testing, this might very well be just MC-91621. In fact, I haven't seen any proof yet that this is in fact an issue with cod, not with the general aquatic mob spawning algorithm.

I attached a debug profile of the issue occurring in a Cold Ocean buffet world. (

[media]

)

Either way, you might be glad to hear that @unknown worked on fixing this issue yesterday. (1, 2, 3)

migrated

This issue is in part related to MC-91621 as rapid spawning and depawning of mobs will still give the mobs time to perform their AI Goals of which, for fish (Cod), is inherently computationally expensive. While not a duplicate, they are both hand-in-hand issues that both effect the same thing.

EarlyReflections

@rockenroll4life

 From what we saw in your recent Tweet, you already have a fix for this. We we also saw is that it's only for the 1.14 development phase. This bug is critical and game-breaking in many ways. Why should some people have to wait until a stable 1.14 release, months away from now, to benefit from that fix when it could be included into a minor 1.13.2 shortly? It would be welcome with open arms and huge relief.

migrated

migrated

Confirmed

Minecraft 1.13, Minecraft 18w31a, Minecraft 1.13.1

Minecraft 1.13.2

Retrieved