aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0127-Remove-CraftScheduler-Async-Task-Debugger.patch
blob: 15ad3dc3e2321bb0d4273de5516b2c50a2a84582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 0000000000000000000000000000000000000000 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 0c0115ccd8541ac62975f4759b4e2083ac560332..300d31e31a55dbee3489320e21e42f14ac429478 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -432,7 +432,7 @@ public class CraftScheduler implements BukkitScheduler {
                 }
                 this.parsePending();
             } else {
-                this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));
+                // this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
                 this.executor.execute(new com.destroystokyo.paper.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)
@@ -447,7 +447,7 @@ public class CraftScheduler implements BukkitScheduler {
         }
         this.pending.addAll(temp);
         temp.clear();
-        this.debugHead = this.debugHead.getNextHead(this.currentTick);
+        //this.debugHead = this.debugHead.getNextHead(this.currentTick); // Paper
     }
 
     private void addTask(final CraftTask task) {
@@ -509,10 +509,15 @@ public class CraftScheduler implements BukkitScheduler {
 
     @Override
     public String toString() {
+        // Paper start
+        return "";
+        /*
         int debugTick = this.currentTick;
         StringBuilder string = new StringBuilder("Recent tasks from ").append(debugTick - CraftScheduler.RECENT_TICKS).append('-').append(debugTick).append('{');
         this.debugHead.debugTo(string);
         return string.append('}').toString();
+        */
+        // Paper end
     }
 
     @Deprecated