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:
parent
539a61e854
commit
ca2014802a
@ -97,7 +97,7 @@ public class ChunkRender
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void markForUpdate() {
|
public void markForUpdate() {
|
||||||
getWorld().markChunkForUpdate(getPosition());
|
getWorld().markChunkForUpdate(getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user