Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
e2c75e81f7
DO NOT RUN ON PRODUCTION SERVERS!!! Use Backups!!
47 Zeilen
2.5 KiB
Diff
47 Zeilen
2.5 KiB
Diff
From cd1396b77d29f151316d181df8ce104bd61c5974 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 4 Mar 2013 23:46:10 -0500
|
|
Subject: [PATCH] Chunk Save Reattempt
|
|
|
|
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
index b247d5f07..f007af2e1 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
@@ -354,11 +354,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
|
NBTTagCompound nbttagcompound = SupplierUtils.getIfExists(chunk.compoundSupplier); // Spigot // Paper
|
|
|
|
if (nbttagcompound != null) {
|
|
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { // Paper
|
|
try {
|
|
this.b(chunkcoordintpair, nbttagcompound);
|
|
+ laste = null; break; // Paper
|
|
} catch (Exception exception) {
|
|
- ChunkRegionLoader.a.error("Failed to save chunk", exception);
|
|
+ //ChunkRegionLoader.a.error("Failed to save chunk", exception); // Paper
|
|
+ laste = exception; // Paper
|
|
}
|
|
+ try {Thread.sleep(10);} catch (InterruptedException e) {e.printStackTrace();} } // Paper
|
|
+ if (laste != null) { com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste); MinecraftServer.LOGGER.error("Failed to save chunk", laste); } // Paper
|
|
}
|
|
|
|
flag = true;
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
|
|
index cc7cad8be..b8b514c87 100644
|
|
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
|
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
|
@@ -238,8 +238,7 @@ public class RegionFile {
|
|
|
|
this.b(i, j, (int) (SystemUtils.d() / 1000L));
|
|
} catch (IOException ioexception) {
|
|
- ioexception.printStackTrace();
|
|
- ServerInternalException.reportInternalException(ioexception); // Paper
|
|
+ org.spigotmc.SneakyThrow.sneaky(ioexception); // Paper - we want the upper try/catch to retry this
|
|
}
|
|
|
|
}
|
|
--
|
|
2.18.0
|
|
|