From 50f2e124a1a6b5af1be8f6e91e6597e9bb866802 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 8 Jan 2017 16:43:08 -0600 Subject: Compromise on warning of excessive velocity sets We have long been receiving feedback about our warning messages when excessive velocities are set on entities. We have, for the most part, ignored much of this feedback because these warnings can be vital in identifying the cause of a watchdog crash. These crashes would otherwise be more difficult to identify without this information. However, in many cases these warnings are unnecessarily verbose as the server handles these excessive sets itself without user intervention. As a compromise, we will only warn the user as part of a watchdog crash log, and we will only include the most recent occurrence. This commit represents a first effort on this front. It may need to be tweaked later to provide more relevant information, such as the time it occurred, and/or not printing the warning at all if the occurrence was a certain time period ago. --- .../0060-Add-velocity-warnings.patch | 46 +++++++++++++++++++--- ...lt-loading-permissions.yml-before-plugins.patch | 8 ++-- ...070-Allow-Reloading-of-Custom-Permissions.patch | 6 +-- .../0071-Remove-Metadata-on-reload.patch | 6 +-- ...gurable-Keep-Spawn-Loaded-range-per-world.patch | 6 +-- ...-Add-setting-for-proxy-online-mode-status.patch | 6 +-- .../0176-Allow-Reloading-of-Command-Aliases.patch | 6 +-- 7 files changed, 60 insertions(+), 24 deletions(-) diff --git a/Spigot-Server-Patches/0060-Add-velocity-warnings.patch b/Spigot-Server-Patches/0060-Add-velocity-warnings.patch index abef25fb17..3c50e650de 100644 --- a/Spigot-Server-Patches/0060-Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/0060-Add-velocity-warnings.patch @@ -1,26 +1,62 @@ -From 92f6a9bc233b3356b37dc4c1804387ecbf4d1da8 Mon Sep 17 00:00:00 2001 +From 870573220f675aa66477ab57fdaa78cc0b1dc993 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld Date: Thu, 3 Mar 2016 02:48:12 -0600 Subject: [PATCH] Add velocity warnings +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 03bc017..c61752b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -173,6 +173,7 @@ public final class CraftServer implements Server { + private final UUID invalidUserUUID = UUID.nameUUIDFromBytes("InvalidUsername".getBytes(Charsets.UTF_8)); + private final List playerView; + public int reloadCount; ++ public static Exception excessiveVelEx; // Paper - Velocity warnings + + private final class BooleanWrapper { + private boolean value = true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 0167ed0..2b1ca7e 100644 +index 0167ed0..c094465 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -229,6 +229,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -229,6 +229,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public void setVelocity(Vector vel) { + // Paper start - Warn server owners when plugins try to set super high velocities + if (!(this instanceof org.bukkit.entity.Projectile) && (vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4)) { -+ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #" + getEntityId() + " to (" + vel.getX() + "," + vel.getY() + "," + vel.getZ() + ")."); -+ Thread.dumpStack(); ++ CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity #" + getEntityId() + " to (" + vel.getX() + "," + vel.getY() + "," + vel.getZ() + ")."); + } + // Paper end entity.motX = vel.getX(); entity.motY = vel.getY(); entity.motZ = vel.getZ(); +diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java +index 3ed983c..6384d50 100644 +--- a/src/main/java/org/spigotmc/WatchdogThread.java ++++ b/src/main/java/org/spigotmc/WatchdogThread.java +@@ -66,7 +66,19 @@ public class WatchdogThread extends Thread + log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" ); + log.log( Level.SEVERE, "near " + net.minecraft.server.World.blockLocation); + } +- // ++ // Paper start - Warn in watchdog if an excessive velocity was ever set ++ if ( org.bukkit.craftbukkit.CraftServer.excessiveVelEx != null ) ++ { ++ log.log( Level.SEVERE, "------------------------------" ); ++ log.log( Level.SEVERE, "During the run of the server, a plugin set an excessive velocity on an entity" ); ++ log.log( Level.SEVERE, "This may be the cause of the issue, or it may be entirely unrelated" ); ++ log.log( Level.SEVERE, org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getMessage()); ++ for ( StackTraceElement stack : org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getStackTrace() ) ++ { ++ log.log( Level.SEVERE, "\t\t" + stack ); ++ } ++ } ++ // Paper end + log.log( Level.SEVERE, "------------------------------" ); + log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); + dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); -- 2.9.3 diff --git a/Spigot-Server-Patches/0069-Default-loading-permissions.yml-before-plugins.patch b/Spigot-Server-Patches/0069-Default-loading-permissions.yml-before-plugins.patch index 57868d36fe..754df1bdd7 100644 --- a/Spigot-Server-Patches/0069-Default-loading-permissions.yml-before-plugins.patch +++ b/Spigot-Server-Patches/0069-Default-loading-permissions.yml-before-plugins.patch @@ -1,4 +1,4 @@ -From cca72bb299e1dd0f6028b3cecaddbf0e1b5aa518 Mon Sep 17 00:00:00 2001 +From 057e2622c79809d9cdf41b2ee46117c09af465c2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 13:17:38 -0400 Subject: [PATCH] Default loading permissions.yml before plugins @@ -30,10 +30,10 @@ index 65fc0cb..7da844e 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 03bc017..54cea6a 100644 +index c61752b..e2afd9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -317,6 +317,7 @@ public final class CraftServer implements Server { +@@ -318,6 +318,7 @@ public final class CraftServer implements Server { if (type == PluginLoadOrder.STARTUP) { helpMap.clear(); helpMap.initializeGeneralTopics(); @@ -41,7 +41,7 @@ index 03bc017..54cea6a 100644 } Plugin[] plugins = pluginManager.getPlugins(); -@@ -334,7 +335,7 @@ public final class CraftServer implements Server { +@@ -335,7 +336,7 @@ public final class CraftServer implements Server { setVanillaCommands(false); // Spigot end commandMap.registerServerAliases(); diff --git a/Spigot-Server-Patches/0070-Allow-Reloading-of-Custom-Permissions.patch b/Spigot-Server-Patches/0070-Allow-Reloading-of-Custom-Permissions.patch index b85fe3c58c..ec535735be 100644 --- a/Spigot-Server-Patches/0070-Allow-Reloading-of-Custom-Permissions.patch +++ b/Spigot-Server-Patches/0070-Allow-Reloading-of-Custom-Permissions.patch @@ -1,4 +1,4 @@ -From 1e22976fc41743796f571137670c9480bfb64e4f Mon Sep 17 00:00:00 2001 +From 49c23225c5302e693fdcbd6b3d139d75b0cf4509 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 18 Mar 2016 03:30:17 -0400 Subject: [PATCH] Allow Reloading of Custom Permissions @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 54cea6a..c3c4803 100644 +index e2afd9d..4009123 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1822,4 +1822,21 @@ public final class CraftServer implements Server { +@@ -1823,4 +1823,21 @@ public final class CraftServer implements Server { { return spigot; } diff --git a/Spigot-Server-Patches/0071-Remove-Metadata-on-reload.patch b/Spigot-Server-Patches/0071-Remove-Metadata-on-reload.patch index 1d793e93fe..1954302a16 100644 --- a/Spigot-Server-Patches/0071-Remove-Metadata-on-reload.patch +++ b/Spigot-Server-Patches/0071-Remove-Metadata-on-reload.patch @@ -1,4 +1,4 @@ -From 18660b67f133ee9c2afc344d0344208bb10082b6 Mon Sep 17 00:00:00 2001 +From b84844e83f6e3e64ff5e9120560d52e0d01e80bb Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 13:50:14 -0400 Subject: [PATCH] Remove Metadata on reload @@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c3c4803..3661821 100644 +index 4009123..540d578 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -740,6 +740,14 @@ public final class CraftServer implements Server { +@@ -741,6 +741,14 @@ public final class CraftServer implements Server { world.paperConfig.init(); // Paper } diff --git a/Spigot-Server-Patches/0106-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/0106-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 4745fe01ff..820109fd5c 100644 --- a/Spigot-Server-Patches/0106-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/0106-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -1,4 +1,4 @@ -From 8a4f59fc1cf5f7bfc7e7e5f1fc16141cf971f7c1 Mon Sep 17 00:00:00 2001 +From a2fb44cbf12b30553ae1b7f1c3bfd9402d282e7a Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 13 Sep 2014 23:14:43 -0400 Subject: [PATCH] Configurable Keep Spawn Loaded range per world @@ -54,10 +54,10 @@ index 2d5f3d2..9c36471 100644 public void a(Packet packet) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3661821..69d9e75 100644 +index 540d578..8cb8cbe 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -951,7 +951,7 @@ public final class CraftServer implements Server { +@@ -952,7 +952,7 @@ public final class CraftServer implements Server { System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")"); if (internal.getWorld().getKeepSpawnInMemory()) { diff --git a/Spigot-Server-Patches/0153-Add-setting-for-proxy-online-mode-status.patch b/Spigot-Server-Patches/0153-Add-setting-for-proxy-online-mode-status.patch index 903970e9ae..d4773ac1cb 100644 --- a/Spigot-Server-Patches/0153-Add-setting-for-proxy-online-mode-status.patch +++ b/Spigot-Server-Patches/0153-Add-setting-for-proxy-online-mode-status.patch @@ -1,4 +1,4 @@ -From 6fb8548de754057d2575e8247e105adde89ea39c Mon Sep 17 00:00:00 2001 +From 5ca24b601302ac12f630371e02174789f3310fbf Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 5 Aug 2016 01:03:08 +0200 Subject: [PATCH] Add setting for proxy online mode status @@ -33,10 +33,10 @@ index 2ff8a6d..52e7360 100644 } else { String[] astring1 = astring; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 69d9e75..50ac5bd 100644 +index 8cb8cbe..1bbce7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1335,7 +1335,8 @@ public final class CraftServer implements Server { +@@ -1336,7 +1336,8 @@ public final class CraftServer implements Server { // Spigot Start GameProfile profile = null; // Only fetch an online UUID in online mode diff --git a/Spigot-Server-Patches/0176-Allow-Reloading-of-Command-Aliases.patch b/Spigot-Server-Patches/0176-Allow-Reloading-of-Command-Aliases.patch index c640cad7ea..7ac2e7724e 100644 --- a/Spigot-Server-Patches/0176-Allow-Reloading-of-Command-Aliases.patch +++ b/Spigot-Server-Patches/0176-Allow-Reloading-of-Command-Aliases.patch @@ -1,4 +1,4 @@ -From 54416434101999dff05cc5befce2bce56fe27061 Mon Sep 17 00:00:00 2001 +From 90fc7033f2b9fb52ba2b0bb3163ce856804fdeb3 Mon Sep 17 00:00:00 2001 From: willies952002 Date: Mon, 28 Nov 2016 10:21:52 -0500 Subject: [PATCH] Allow Reloading of Command Aliases @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 50ac5bd..895fe59 100644 +index 1bbce7a..31c9a66 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1847,5 +1847,15 @@ public final class CraftServer implements Server { +@@ -1848,5 +1848,15 @@ public final class CraftServer implements Server { }); } } -- cgit v1.2.3