Paper/Spigot-Server-Patches/0368-Fix-FileIOThread-concurrency-issues.patch
Shane Freeder fb25dc17c6 Updated Upstream (Bukkit/CraftBukkit)
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

Bukkit Changes:
da08d022 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
0cef14e4 Remove draft API from selectEntities

CraftBukkit Changes:
a46fdbc6 Remove outdated build delay.
3697519b SPIGOT-4708: Fix ExactChoice recipes neglecting material
9ead7009 SPIGOT-4677: Add minecraft.admin.command_feedback permission
c3749a23 Remove the Damage tag from items when it is 0.
f74c7b95 SPIGOT-4706: Can't interact with active item
494eef45 Mention requirement of JIRA ticket for bug fixes
51d62dec SPIGOT-4702: Exception when middle clicking certain slots
be557e69 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
2019-04-22 22:36:14 +01:00

36 lines
1.6 KiB
Diff

From 4e5812633b869d071215da93dc3cffd797de9951 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 3c688f546c..570624600d 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