SPIGOT-5378: Fix TileEntity fixer deadlock

Chunk loading logic can make getTileEntity calls, and these can
be off of the main thread (i.e lighting). The TileEntity fixer
makes a getType call, which will block on chunk load. Thus a
deadlock can occur between a lighting thread and the server thread.

By: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot
2019-10-20 00:50:26 -07:00
parent c0692c1e1b
commit f2be8b0482
2 changed files with 42 additions and 29 deletions

View File

@@ -23,6 +23,15 @@
public abstract class World implements IIBlockAccess, GeneratorAccess, AutoCloseable {
protected static final Logger LOGGER = LogManager.getLogger();
@@ -23,7 +39,7 @@
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
protected final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
private final long b = 16777215L;
- private final Thread serverThread;
+ final Thread serverThread; // CraftBukkit - package private
private int u;
protected int i = (new Random()).nextInt();
protected final int j = 1013904223;
@@ -41,7 +57,51 @@
protected boolean tickingTileEntities;
private final WorldBorder worldBorder;