Remove CraftScheduler Async Task Debugger

I have not once ever seen this system help debug a crash.
One report of a suspected memory leak with the system.

This adds additional overhead to asynchronous task dispatching
This commit is contained in:
Aikar 2017-02-05 00:13:28 -05:00
parent d49de13c00
commit c7d8bd43fb
2 changed files with 78 additions and 16 deletions

View File

@ -1,4 +1,4 @@
From 8e50cd23191f03f84cf5511322d9f898c3c095e7 Mon Sep 17 00:00:00 2001
From d2b86b9051ba6b0bba4f9a4f81793c6231860bbd Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644
index 0000000..9339718
index 000000000..93397188b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,38 @@
@ -50,7 +50,7 @@ index 0000000..9339718
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index e1fc4ea..8f1a68d 100644
index e1fc4ea6c..8f1a68d67 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@ -89,7 +89,7 @@ index e1fc4ea..8f1a68d 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index df3ce72..54ca738 100644
index f7f2d12cf..b0a82e7ed 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -12,6 +12,7 @@ import java.util.Iterator;
@ -144,7 +144,7 @@ index df3ce72..54ca738 100644
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 016c64e..2ff8a6d 100644
index 016c64e82..2ff8a6da0 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,6 @@
@ -171,7 +171,7 @@ index 016c64e..2ff8a6d 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
index 936d6c6..50056f4 100644
index 936d6c640..50056f49a 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -1,5 +1,6 @@
@ -198,7 +198,7 @@ index 936d6c6..50056f4 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index b0279ac..be13c11 100644
index b0279ac3e..be13c1131 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@
@ -225,7 +225,7 @@ index b0279ac..be13c11 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 933934f..19fbf9b 100644
index 933934fb6..19fbf9b4a 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,5 +1,6 @@
@ -244,7 +244,7 @@ index 933934f..19fbf9b 100644
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index a05fad5..29219ec 100644
index a05fad54f..29219ec7b 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -7,6 +7,7 @@ import java.util.Random;
@ -272,7 +272,7 @@ index a05fad5..29219ec 100644
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 7af5b7d..2b49802 100644
index 7af5b7dd7..2b498024c 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@
@ -292,7 +292,7 @@ index 7af5b7d..2b49802 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 857b423..a35741a 100644
index 8b8054ca0..b11ebed03 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@
@ -328,20 +328,20 @@ index 857b423..a35741a 100644
this.tileEntityListTick.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 198c37c..cdb836a 100644
index 9952b64be..e30cfb7b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -14,6 +14,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import co.aikar.timings.MinecraftTimings; // Paper
+import com.destroystokyo.paper.ServerSchedulerReportingWrapper;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerSchedulerException;
import org.apache.commons.lang.Validate;
import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin;
@@ -351,18 +354,24 @@ public class CraftScheduler implements BukkitScheduler {
@@ -352,18 +355,24 @@ public class CraftScheduler implements BukkitScheduler {
try {
task.run();
} catch (final Throwable throwable) {
@ -372,5 +372,5 @@ index 198c37c..cdb836a 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--
2.9.3
2.11.0

View File

@ -0,0 +1,62 @@
From 435ae1796a4182dbaafc61178e9b0a29f981f168 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 5 Feb 2017 00:04:04 -0500
Subject: [PATCH] Remove CraftScheduler Async Task Debugger
I have not once ever seen this system help debug a crash.
One report of a suspected memory leak with the system.
This adds additional overhead to asynchronous task dispatching
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index e30cfb7b7..448c27cc7 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -80,8 +80,8 @@ public class CraftScheduler implements BukkitScheduler {
private final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<Integer, CraftTask>();
private volatile int currentTick = -1;
private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot
- private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}};
- private CraftAsyncDebugger debugTail = debugHead;
+ //private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}}; // Paper
+ //private CraftAsyncDebugger debugTail = debugHead; // Paper
private static final int RECENT_TICKS;
static {
@@ -371,7 +371,7 @@ public class CraftScheduler implements BukkitScheduler {
}
parsePending();
} else {
- debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));
+ //debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
@@ -388,7 +388,7 @@ public class CraftScheduler implements BukkitScheduler {
pending.addAll(temp);
temp.clear();
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming();
- debugHead = debugHead.getNextHead(currentTick);
+ //debugHead = debugHead.getNextHead(currentTick); // Paper
}
private void addTask(final CraftTask task) {
@@ -447,10 +447,15 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public String toString() {
+ // Paper start
+ return "";
+ /*
int debugTick = currentTick;
StringBuilder string = new StringBuilder("Recent tasks from ").append(debugTick - RECENT_TICKS).append('-').append(debugTick).append('{');
debugHead.debugTo(string);
return string.append('}').toString();
+ */
+ // Paper end
}
@Deprecated
--
2.11.0