Paper/Spigot-Server-Patches/0369-Fix-FileIOThread-concurrency-issues.patch
Shane Freeder ea855e2b46 Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Developers!: You will need to clean up your work/Minecraft/1.13.2 folder
for this

Also, restore a patch that was dropped in the last upstream

Bukkit Changes:
279eeab3 Fix command description not being set
96e2bb18 Remove debug print from SyntheticEventTest

CraftBukkit Changes:
d3ed1516 Fix dangerously threaded beacons
217a293d Don't relocate joptsimple to allow --help to work.
1be05a21 Prepare for imminent Java 12 release
a49270b2 Mappings Update
5259d80c SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports

Spigot Changes:
e6eb36f2 Rebuild patches
2019-03-20 01:55:16 +00:00

36 lines
1.6 KiB
Diff

From a3fbb3c9303e070a1a4110b2bcacfb69e5562054 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 3 Oct 2018 19:04:53 +0100
Subject: [PATCH] Fix FileIOThread concurrency issues
FileIOThread was using two volatile counters in order to track if
any pending work was in the queue, this causes potential concurrency
issues when this counter is updated from multiple threads, potentially
causing these counters to desync due to the unsafe volatile update
diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java
index 3c688f546..570624600 100644
--- a/src/main/java/net/minecraft/server/FileIOThread.java
+++ b/src/main/java/net/minecraft/server/FileIOThread.java
@@ -10,7 +10,7 @@ public class FileIOThread implements Runnable {
private static final Logger a = LogManager.getLogger();
private static final FileIOThread b = new FileIOThread();
- private final List<IAsyncChunkSaver> c = Collections.synchronizedList(Lists.newArrayList());
+ private final List<IAsyncChunkSaver> c = Collections.synchronizedList(Lists.newArrayList()); private List<IAsyncChunkSaver> getThreadedIOQueue() { return c; } // Paper - OBFHELPER
private volatile long d;
private volatile long e;
private volatile boolean f;
@@ -75,7 +75,7 @@ public class FileIOThread implements Runnable {
public void b() throws InterruptedException {
this.f = true;
- while (this.d != this.e) {
+ while(!this.getThreadedIOQueue().isEmpty()) { // Paper - check actual list size
Thread.sleep(10L);
}
--
2.21.0