aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2016-05-13 01:34:37 -0400
committerAikar <[email protected]>2016-05-13 01:34:37 -0400
commitbf2ed8af453a3aa0cce4d5b5b4c2fc34e17c4f10 (patch)
treeea8cf3a6b4812dda61629fc80f65bb1c900b3ab7
parent2304826f19055e81e42c2e3871b8466722bb47bc (diff)
downloadPaper-bf2ed8af453a3aa0cce4d5b5b4c2fc34e17c4f10.tar.gz
Paper-bf2ed8af453a3aa0cce4d5b5b4c2fc34e17c4f10.zip
Fix chunk leak issue with queued light updates
-rw-r--r--Spigot-Server-Patches/0004-MC-Utils.patch28
-rw-r--r--Spigot-Server-Patches/0031-Lighting-Queue.patch6
-rw-r--r--Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch (renamed from Spigot-Server-Patches/0152-Fix-chunk-unload-leak-issues-due-to-neighbor-updates.patch)48
-rw-r--r--Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch8
4 files changed, 54 insertions, 36 deletions
diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch
index c8cfd6019b..60461f24cb 100644
--- a/Spigot-Server-Patches/0004-MC-Utils.patch
+++ b/Spigot-Server-Patches/0004-MC-Utils.patch
@@ -1,4 +1,4 @@
-From 510ca29c8152d471740af9cf9bd99f3f9c0af690 Mon Sep 17 00:00:00 2001
+From 3e274493dd2ceaa090253d2797e7c5bdbd55d2d5 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
@@ -7,14 +7,15 @@ Collection of utils to help reduce NMS diff
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644
-index 0000000..ffd3152
+index 0000000..d3a256c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
-@@ -0,0 +1,119 @@
+@@ -0,0 +1,141 @@
+package net.minecraft.server;
+
+import org.bukkit.Location;
+
++import javax.annotation.Nullable;
+import java.util.regex.Pattern;
+
+public class MCUtil {
@@ -129,6 +130,27 @@ index 0000000..ffd3152
+ final int modZ = pos.getZ() & 15;
+ return (modX == 0 || modX == 15 || modZ == 0 || modZ == 15);
+ }
++
++ /**
++ * Gets a chunk without changing its boolean for should unload
++ * @param world
++ * @param x
++ * @param z
++ * @return
++ */
++ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(World world, int x, int z) {
++ return ((ChunkProviderServer) world.chunkProvider).chunks.get(ChunkCoordIntPair.a(x, z));
++ }
++ /**
++ * Gets a chunk without changing its boolean for should unload
++ * @param provider
++ * @param x
++ * @param z
++ * @return
++ */
++ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(ChunkProviderServer provider, int x, int z) {
++ return provider.chunks.get(ChunkCoordIntPair.a(x, z));
++ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index c01cecb..7fa49dd 100644
diff --git a/Spigot-Server-Patches/0031-Lighting-Queue.patch b/Spigot-Server-Patches/0031-Lighting-Queue.patch
index bebbab474a..368e242597 100644
--- a/Spigot-Server-Patches/0031-Lighting-Queue.patch
+++ b/Spigot-Server-Patches/0031-Lighting-Queue.patch
@@ -1,4 +1,4 @@
-From 254eb4d02c98435ce53fc85794f9912f9b3c63e2 Mon Sep 17 00:00:00 2001
+From 5efa3dbdcbafbb869d80578874d617adbdbbe687 Mon Sep 17 00:00:00 2001
From: Byteflux <[email protected]>
Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue
@@ -32,7 +32,7 @@ index 7c0e61f..8e3a0f3 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 5690e81..3bcbbb9 100644
+index 5690e81..42fef0a 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -45,6 +45,7 @@ public class Chunk {
@@ -122,7 +122,7 @@ index 5690e81..3bcbbb9 100644
+ continue;
+ }
+
-+ Chunk chunk = world.getChunkIfLoaded(x, z);
++ Chunk chunk = MCUtil.getLoadedChunkWithoutMarkingActive(world, x, z);
+ if (chunk != null && chunk.lightUpdates > 0) {
+ return true;
+ }
diff --git a/Spigot-Server-Patches/0152-Fix-chunk-unload-leak-issues-due-to-neighbor-updates.patch b/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch
index 59aa330ecf..0c0f0c0ed5 100644
--- a/Spigot-Server-Patches/0152-Fix-chunk-unload-leak-issues-due-to-neighbor-updates.patch
+++ b/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch
@@ -1,46 +1,34 @@
-From 0e5163d49b0f3e4f8f0db6d6c65afd55256e7487 Mon Sep 17 00:00:00 2001
+From 9df0a1beae6afe76606eb96db443a735faf77eba Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Thu, 12 May 2016 01:55:17 -0400
-Subject: [PATCH] Fix chunk unload leak issues due to neighbor updates
+Subject: [PATCH] Do not mark chunks as active for neighbor updates
+Fixes chunk unload issues
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-index 8ee8e80..694f3d5 100644
+index 8ee8e80..1bc001d 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-@@ -78,6 +78,12 @@ public class ChunkProviderServer implements IChunkProvider {
- }
-
- }
-+ // Paper start
-+ @Nullable
-+ public Chunk getLoadedChunkAtWithoutMarkingActive(int i, int j) {
-+ return this.chunks.get(ChunkCoordIntPair.a(i, j));
-+ }
-+ // Paper end
-
- @Nullable
- public Chunk getLoadedChunkAt(int i, int j) {
-@@ -197,7 +203,7 @@ public class ChunkProviderServer implements IChunkProvider {
+@@ -197,7 +197,7 @@ public class ChunkProviderServer implements IChunkProvider {
continue;
}
- Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
-+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
++ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
-@@ -318,7 +324,7 @@ public class ChunkProviderServer implements IChunkProvider {
+@@ -318,7 +318,7 @@ public class ChunkProviderServer implements IChunkProvider {
continue;
}
- Chunk neighbor = this.chunks.get(ChunkCoordIntPair.a(chunk.locX + x, chunk.locZ + z));
-+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
++ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 1adfc03..8246964 100644
+index 1adfc03..b1a7435 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -241,7 +241,7 @@ public class CraftWorld implements World {
@@ -48,7 +36,7 @@ index 1adfc03..8246964 100644
}
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
-+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
++ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
if (neighbor != null) {
neighbor.setNeighborUnloaded(-xx, -zz);
chunk.setNeighborUnloaded(xx, zz);
@@ -57,20 +45,28 @@ index 1adfc03..8246964 100644
}
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
-+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
++ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
-index 7b61b14..a1668e2 100644
+index 7b61b14..7752b50 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
-@@ -62,7 +62,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
+@@ -5,7 +5,6 @@ import net.minecraft.server.Chunk;
+ import net.minecraft.server.ChunkCoordIntPair;
+ import net.minecraft.server.ChunkRegionLoader;
+ import net.minecraft.server.NBTTagCompound;
+-
+ import org.bukkit.Server;
+ import org.bukkit.craftbukkit.util.AsynchronousExecutor;
+
+@@ -62,7 +61,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
continue;
}
- Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
-+ Chunk neighbor = queuedChunk.provider.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
++ Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(queuedChunk.provider, chunk.locX + x, chunk.locZ + z); // Paper
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
diff --git a/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch b/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch
index ad62ad4ec0..0b2d63bd36 100644
--- a/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch
+++ b/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch
@@ -1,11 +1,11 @@
-From d2cbd64700e4bd54a1aec471f69977b63c6ea2ec Mon Sep 17 00:00:00 2001
+From e5bd49a93687c1a4aed20c45b62283540017f6a0 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Thu, 12 May 2016 02:03:56 -0400
Subject: [PATCH] Unmark chunk as unloading when unload is cancelled
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 4953e97..1981ae4 100644
+index 1e172b8..f72b1f8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -46,7 +46,7 @@ public class Chunk {
@@ -18,10 +18,10 @@ index 4953e97..1981ae4 100644
public int lightUpdates; // Paper - Number of queued light updates for this chunk
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-index 694f3d5..f67dbae 100644
+index 1bc001d..7820ad9 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider {
+@@ -303,6 +303,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = (Chunk) this.chunks.get(olong);
if (chunk != null && chunk.d) {