aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2019-04-15 05:06:43 +0100
committerShane Freeder <[email protected]>2019-04-15 05:09:57 +0100
commit9c79f489ed6d273a262199c615d4f5449a393248 (patch)
treed45e3304cfa3a3e93baedb594f1da659e94223c7
parent41c86a654882e668040d5e4f24840bbf93e6dd78 (diff)
downloadPaper-9c79f489ed6d273a262199c615d4f5449a393248.tar.gz
Paper-9c79f489ed6d273a262199c615d4f5449a393248.zip
Don't try to read the data outside of the try-catch
-rw-r--r--Spigot-Server-Patches/0438-Handle-bad-chunks-more-gracefully.patch9
-rw-r--r--removed/0290-Handle-bad-chunks-more-gracefully.patch53
2 files changed, 5 insertions, 57 deletions
diff --git a/Spigot-Server-Patches/0438-Handle-bad-chunks-more-gracefully.patch b/Spigot-Server-Patches/0438-Handle-bad-chunks-more-gracefully.patch
index d1e27249b4..d7da65805e 100644
--- a/Spigot-Server-Patches/0438-Handle-bad-chunks-more-gracefully.patch
+++ b/Spigot-Server-Patches/0438-Handle-bad-chunks-more-gracefully.patch
@@ -1,4 +1,4 @@
-From a5bd0235ffaaae6207d3ac887c2b8ccc2b60d39d Mon Sep 17 00:00:00 2001
+From ea03a714afb61798851be72f35684477ce4e5710 Mon Sep 17 00:00:00 2001
From: Shane Freeder <[email protected]>
Date: Mon, 15 Apr 2019 02:24:52 +0100
Subject: [PATCH] Handle bad chunks more gracefully
@@ -15,16 +15,17 @@ Should Mojang choose to alter this behavior in the future, this change
will simply defer to whatever that new behavior is.
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
-index 17e76815ad..2eb7888027 100644
+index 17e76815ad..369aaa84c4 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -171,8 +171,20 @@ public class RegionFileCache {
private static NBTTagCompound readOversizedChunk(RegionFile regionfile, int i, int j) throws IOException {
synchronized (regionfile) {
try (DataInputStream datainputstream = regionfile.getReadStream(i & 31, j & 31)) {
-+ // Paper start - Handle bad chunks more gracefully - also handle similarly with oversized data
- NBTTagCompound oversizedData = regionfile.getOversizedData(i, j);
+- NBTTagCompound oversizedData = regionfile.getOversizedData(i, j);
- NBTTagCompound chunk = NBTCompressedStreamTools.readNBT(datainputstream);
++ // Paper start - Handle bad chunks more gracefully - also handle similarly with oversized data
++ NBTTagCompound oversizedData = null;
+
+ try {
+ oversizedData = regionfile.getOversizedData(i, j);
diff --git a/removed/0290-Handle-bad-chunks-more-gracefully.patch b/removed/0290-Handle-bad-chunks-more-gracefully.patch
deleted file mode 100644
index 57a94aa2eb..0000000000
--- a/removed/0290-Handle-bad-chunks-more-gracefully.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 6ed3ea16d5ae3197d4539bc110fcc9610b7e9888 Mon Sep 17 00:00:00 2001
-From: Zach Brown <[email protected]>
-Date: Tue, 17 Apr 2018 21:26:31 -0400
-Subject: [PATCH] Handle bad chunks more gracefully
-
-Prior to this change the server would crash when attempting to load a
-chunk from a region with bad data.
-
-After this change the server will defer back to vanilla behavior. At
-this time, that means attempting to generate a chunk in its place
-(and occasionally just not generating anything and leaving small
-holes in the world).
-
-Should Mojang choose to alter this behavior in the future, this change
-will simply defer to whatever that new behavior is.
-
-diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-index de859ffd1..55dada668 100644
---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
-+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-@@ -162,6 +162,13 @@ public class ChunkProviderServer implements IChunkProvider {
- return null;
- } else {
- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
-+
-+ // Paper start - If there was an issue loading the chunk from region, stage1 will fail and stage2 will load it sync
-+ // all we need to do is fetch an instance
-+ if (chunk == null) {
-+ chunk = getChunkIfLoaded(i, j);
-+ }
-+ // Paper end
- }
- } else if (chunk == null && generate) {
- chunk = originalGetChunkAt(i, j);
-diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
-index ef9529add..cdf3b614c 100644
---- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
-+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
-@@ -30,6 +30,11 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
- return null;
- } catch (IOException ex) {
- throw new RuntimeException(ex);
-+ // Paper - Mirror vanilla by catching everything (else) rather than immediately crashing the server
-+ // stage2 will receive a null chunk and then load it synchronously, where vanilla MC will properly log and recover
-+ // stage2 will _not_ however return that instance, only load it
-+ } catch (Exception ex) {
-+ return null;
- }
- }
-
---
-2.18.0
-