Use monotonic time for watchdog

This commit is contained in:
md_5 2018-11-23 21:27:04 +11:00
parent bc4adcbfd6
commit a1f2566f69
10 changed files with 44 additions and 34 deletions

View file

@ -1,4 +1,4 @@
From b9561ecc68b774b90f8c9d9eceb0db1ff8c8578d Mon Sep 17 00:00:00 2001
From d1f0cfe0a54b16aca16dd55884bb0ecf0458c202 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 15 May 2017 15:16:15 +1000
Subject: [PATCH] Skeleton API Implementations
@ -131,10 +131,10 @@ index c8b5154e..ee2218c1 100644
+ // Spigot end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 769b997b..f74a7d86 100644
index 9399a420..ca332102 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1491,4 +1491,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1477,4 +1477,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* after permission changes are done.
*/
public void updateCommands();

View file

@ -1,14 +1,14 @@
From 90259220c37c8bc843a3e6f9c552c3468f76eec2 Mon Sep 17 00:00:00 2001
From 65b9e799b584e16c36a84590fd4789d7095d6f46 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:20:49 +1000
Subject: [PATCH] BungeeCord Support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f74a7d86..203d5af3 100644
index ca332102..27de9c94 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1496,6 +1496,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1482,6 +1482,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public class Spigot extends Entity.Spigot
{

View file

@ -1,14 +1,14 @@
From daee4a289542bdf4bf0f6308e1eed3cf025047be Mon Sep 17 00:00:00 2001
From 0376fae9bd5adcbd00626362264f1f01bdf7defe Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 3 Aug 2013 19:20:50 +1000
Subject: [PATCH] Player Collision API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 203d5af3..3675f538 100644
index 27de9c94..3c3b8388 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1506,6 +1506,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1492,6 +1492,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
{
throw new UnsupportedOperationException( "Not supported yet." );
}

View file

@ -1,14 +1,14 @@
From d0950c689cd805d084ce16ea04648533a9aa2b99 Mon Sep 17 00:00:00 2001
From 74d01b64e069e96e1ae36dd36305f69baec6bd96 Mon Sep 17 00:00:00 2001
From: ninja- <xninja@openmailbox.org>
Date: Tue, 8 Oct 2013 14:35:58 +0200
Subject: [PATCH] Add respawn API.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 3675f538..b780cac5 100644
index 3c3b8388..730b0fc2 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1531,6 +1531,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1517,6 +1517,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
{
throw new UnsupportedOperationException( "Not supported yet." );
}

View file

@ -1,14 +1,14 @@
From 72651294548f1fdd424154a135ea29c1d7165ee6 Mon Sep 17 00:00:00 2001
From b11e3e57e863d5bd81190379336787211071997f Mon Sep 17 00:00:00 2001
From: Smove <jan@lavasurvival.net>
Date: Sat, 1 Feb 2014 18:10:49 +1100
Subject: [PATCH] Implement Locale Getter for Players
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b780cac5..f3ea06c6 100644
index 730b0fc2..36167aa0 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1539,6 +1539,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1525,6 +1525,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
{
throw new UnsupportedOperationException( "Not supported yet." );
}

View file

@ -1,14 +1,14 @@
From 3362bde555613c609a77f50465fe6087df72e7fa Mon Sep 17 00:00:00 2001
From 61e4ffdb380f59cfbd9d6f983f9e08b0a0fc0a06 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Sun, 9 Feb 2014 14:02:11 -0500
Subject: [PATCH] Add support for fetching hidden players
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f3ea06c6..17f2da30 100644
index 36167aa0..2e89cd77 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1551,6 +1551,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1537,6 +1537,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
{
throw new UnsupportedOperationException( "Not supported yet." );
}

View file

@ -1,14 +1,14 @@
From c03f1674a8ec58ebe9b531a8a4e14b23d4ec9438 Mon Sep 17 00:00:00 2001
From 5487fe15eb563406b1e40399ddc8feb67e28f3f6 Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu>
Date: Wed, 23 Jul 2014 15:50:36 -0400
Subject: [PATCH] Undeprecate Player#updateInventory()V
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 9c65a907..a7ca94ad 100644
index 2e89cd77..30805455 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -431,10 +431,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -417,10 +417,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Forces an update of the player's entire inventory.
*

View file

@ -1,4 +1,4 @@
From 111f77606410dc7517aeed1535d871a69f5bc303 Mon Sep 17 00:00:00 2001
From c9aa8d08d3b68f55e685297e904fea1c0db7a210 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sat, 13 Dec 2014 02:59:14 +0100
Subject: [PATCH] BungeeCord Chat API
@ -325,10 +325,10 @@ index 5dcd2218..abf68a2c 100644
Spigot spigot();
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 4b6cd0af..cbd0e51e 100644
index 30805455..5054276f 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1559,6 +1559,36 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1545,6 +1545,36 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
{
throw new UnsupportedOperationException( "Not supported yet." );
}

View file

@ -1,4 +1,4 @@
From 2462dfc4557fcefacb18172ba43d70e3ea1c977f Mon Sep 17 00:00:00 2001
From 36820c3f11f95bcc60482ec741f3752387611e9c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 5 Aug 2014 17:20:19 +0100
Subject: [PATCH] Watchdog Thread.
@ -216,10 +216,10 @@ index cec3c4b24..d8145db91 100644
}
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
new file mode 100644
index 000000000..de08ad67f
index 000000000..1d60ddf0d
--- /dev/null
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -0,0 +1,117 @@
@@ -0,0 +1,127 @@
+package org.spigotmc;
+
+import java.lang.management.ManagementFactory;
@ -246,6 +246,11 @@ index 000000000..de08ad67f
+ this.restart = restart;
+ }
+
+ private static long monotonicMillis()
+ {
+ return System.nanoTime() / 1000000L;
+ }
+
+ public static void doStart(int timeoutTime, boolean restart)
+ {
+ if ( instance == null )
@ -257,7 +262,7 @@ index 000000000..de08ad67f
+
+ public static void tick()
+ {
+ instance.lastTick = System.currentTimeMillis();
+ instance.lastTick = monotonicMillis();
+ }
+
+ public static void doStop()
@ -274,11 +279,16 @@ index 000000000..de08ad67f
+ while ( !stopping )
+ {
+ //
+ if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime )
+ if ( lastTick != 0 && monotonicMillis() > lastTick + timeoutTime )
+ {
+ Logger log = Bukkit.getServer().getLogger();
+ log.log( Level.SEVERE, "The server has stopped responding!" );
+ log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" );
+ log.log( Level.SEVERE, "------------------------------" );
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Spigot bug." );
+ log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
+ log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
+ log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
+ log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Spigot bug, please report to https://www.spigotmc.org/" );
+ log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
+ log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
+ //

View file

@ -1,4 +1,4 @@
From 54068e78f245b5fb362b59ef1bb44efc149d7467 Mon Sep 17 00:00:00 2001
From 993169ba34f9b1cfb02e81e4f2f12c7aabe3c044 Mon Sep 17 00:00:00 2001
From: David <dmck2b@gmail.com>
Date: Mon, 21 Apr 2014 12:43:08 +0100
Subject: [PATCH] Prevent NoClassDefError crash and notify on crash
@ -29,10 +29,10 @@ index 450f167d9..fe1979b3a 100644
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index de08ad67f..94a3d4237 100644
index 1d60ddf0d..14a1084aa 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -60,6 +60,13 @@ public class WatchdogThread extends Thread
@@ -70,6 +70,13 @@ public class WatchdogThread extends Thread
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
//