From 1abd2bd279e556fdd3cd99eae49bbf51fb9591d3 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 May 2020 03:07:04 -0400 Subject: [PATCH] Don't flush packet queue off main thread Increases risk of deadlock if a plugin using protocollib sends a packet async, and then a listener then reads world state, and main thread is then blocked waiting for the queue to flush. This will break out of the synchronized block when it jumps to the netty event loop. See: https://gist.github.com/aikar/e7abb2ba7059149d0a91f7a226e98590 --- ...ndle-Excessive-Signs-in-Chunks-creating-large-pack.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch b/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch index 4c78fc825..ca718327e 100644 --- a/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch +++ b/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch @@ -1,4 +1,4 @@ -From 57f98e2c510b576b4d3c94b12384b1bc4b6b5e33 Mon Sep 17 00:00:00 2001 +From 10a32d733a851719edd4c52fc25d673f1e3be4fd Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 2 Mar 2019 14:55:01 -0500 Subject: [PATCH] Handle Excessive Signs in Chunks creating large packets @@ -14,7 +14,7 @@ With further contributions from Co-Authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index b1dededc15..e966b6edcc 100644 +index b1dededc15..07e3ddb6e9 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -158,19 +158,55 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -73,7 +73,7 @@ index b1dededc15..e966b6edcc 100644 + + this.packetQueue.addAll(packets); // atomic + } -+ this.sendPacketQueue(); // ensure only one flush call is made ++ if (MCUtil.isMainThread()) this.sendPacketQueue(); + // Paper end }