Fix concurrency issue in light engine (Vanilla bug)

Mojang implemented a cache like chunks have, but this cache
is accessed by multiple threads and is totally not safe.

So just remove it

Fixes #3466

Also missed a pooled nibble release, so slid that in there too.
This commit is contained in:
Aikar
2020-05-28 16:59:38 -04:00
parent db127b6f9c
commit 6bff219f15
2 changed files with 35 additions and 3 deletions

View File

@@ -57,7 +57,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void a(long i) {
if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data
- this.data.queueUpdate(i, ((NibbleArray) this.data.getUpdating(i)).b()); // Paper - avoid copying light data
+ this.data.queueUpdate(i, new NibbleArray().markPoolSafe(this.data.getUpdating(i).getCloneIfSet())); // Paper - avoid copying light data - pool safe clone
+ NibbleArray updating = this.data.getUpdating(i); // Paper - pool nibbles
+ this.data.queueUpdate(i, new NibbleArray().markPoolSafe(updating.getCloneIfSet())); // Paper - avoid copying light data - pool safe clone
+ if (updating.cleaner != null) updating.cleaner.run(); // Paper
this.c();
}