Commit Graph

7 Commits

Author SHA1 Message Date
Aikar
ff4ca31f0d
Fix premature unloading of neighbor chunks for world gen
We must check the level tracker as ticket levels add "virtual"
tickets to neighbors.

Also added neighbor tracking during generation to be extra safe.

Fixes #3465
Fixes #3451
Fixes #3459
2020-05-28 22:59:40 -04:00
Aikar
21f9efa2ca
Improve implementation of chunk leak clean to not run as often 2020-05-25 21:42:53 -04:00
Aikar
7ee711460f
Add missing null check for structure start chunk access
Spigot made structure start not load chunks, but forgot to null check
the result...

This likely never blew up before due to the chunk leak issue, but now
that leaky chunks are cleaned up, it was identified.
2020-05-25 14:19:11 -04:00
Aikar
b12177fb04
One more to seal the deal to improve unloading inactive chunks
While last was mostly there, still had some slight risk of unloading
before it was fully finished.

So just going to bump the delay to 3 minutes to be safe. Better than
forever at least.

Was really hoping we could unload them as soon as they were done to
any memory prematurely promoting to old generation, but guess we can't.
2020-05-25 13:09:56 -04:00
Aikar
78ee3b4e88
Restore a condition I accidently removed in last build 2020-05-25 12:53:40 -04:00
Aikar
88a6882930
Fix unloading inaccessible chunks too fast regressing gen speed
A chunk was loaded but not yet finished in use and was unloaded too early.

This caused it to be reloaded again or caused crashes.

Now also check if the chunk pops out of the unload queue that it also
doesn't now have a ticket either.
2020-05-25 12:36:19 -04:00
Aikar
210a32f26f
Unload leaked Cached Chunks
Due to some complexity in mojangs complicated chain of juggling
whether or not a chunk should be unloaded when the last ticket is
removed, many chunks are remaining around in the cache.

These chunks are never being targetted for unload because they are
vastly out of view distance range and have no reason to be looked at.

This is a huge issue for performance because we have to iterate these
chunks EVERY TICK... This is what's been leading to high SELF time in
Ticking Chunks timings/profiler results.

We will now detect these chunks in that iteration, and automatically
add it to the unload queue when the chunk is found without any tickets.
2020-05-25 11:12:22 -04:00