mojira.dev
MC-100382

DEV - Pathfinding Memory Leak

We have identified a memory leak in Minecraft's Pathfinding System.
In MCP Naming, the NodeProcessor class (PathfinderAbstract in mc-dev naming) is the culprit.

First parameter is IBlockAccess, which is set by the first method in the class. This parameter is set to an instance of a Chunk Cache.

However, the 2nd method called postProcess in MCP, never cleans up this reference.

This causes an Entity's Pathfinding instances to hold onto a reference of a ChunkCache.

This ChunkCache then holds references to many Chunks, even after they unload.

These unloaded chunks then hold references to other leaked Entity objects, who also have references to Pathfinders...

This leaks to potential to create a chain of leaked objects.

Attachments

Comments

migrated
[media]
migrated
migrated

I think I am able to confirm.

[Edit: I am definitely able to confirm]

migrated

Interesting. I've yet to try your patch, and to see if it just works for you or if it works for both of us.

migrated

Good catch.

The reference was indeed never release. Thanks for pointing it out.

migrated

Is this the cause of MC-94438?

migrated

Possibly, we'll see if that gets fixed next version as well

migrated

I don't believe so, as this memory leak also affects 1.8.

I wonder if MC-94438 has to do with Grass blocks triggering Chunk Loads for Light Level checks.
As that is another flaw we've recently found.

My quick bandaid for that in paper is to return 0 for unloaded chunks light level... Which should only ever happen for blocks that gather light data from neighbor, and that would result in it using 1 of the other 3-4 neighbors.

Maybe thats good enough for Vanilla to do?

migrated

See MC-100341 for that.

migrated

@unknown Yeah I'm saying MC-100341 and also MC-98994 might be related to the cause of MC-94438, since the latter is a very generic "I'm Lagging".

migrated

WHAT IS THIS BUG it's more like a "Security Issue"

migrated

@unknown no, it is not. This bug has been in Minecraft for years, and not something players can intentionally trigger at a scale to crash a server.

migrated

(Unassigned)

Unconfirmed

memory-leak

Minecraft 1.9.2

Minecraft 16w14a

Retrieved