Resolved a random deadlock that became way too frequent to ignore

There was a deadlock that sometimes occurred when passing PacketSetBlock
to client: PacketSetBlock first acquired monitor of the chunk it
modified, than attempted to lock the visible chunks set. In parallel, a
chunk update first acquires the visible chunks, than the individual
chunk. Turns out, markForUpdate() doesn't need to be synchronized, so
PacketSetBlock can now acquire the locks sequentially, avoiding the
deadlock.
This commit is contained in:
2021-08-18 09:30:29 +03:00
parent 539a61e854
commit ca2014802a

View File

@ -97,7 +97,7 @@ public class ChunkRender
return data;
}
public synchronized void markForUpdate() {
public void markForUpdate() {
getWorld().markChunkForUpdate(getPosition());
}