geforkt von Mirrors/Paper
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.
Dieser Commit ist enthalten in:
Ursprung
7732ba46d9
Commit
eccac70eac
@ -4,6 +4,18 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
private final UUID invalidUserUUID = UUID.nameUUIDFromBytes("InvalidUsername".getBytes(Charsets.UTF_8));
|
||||
private final List<CraftPlayer> 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@ -14,11 +26,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -0,0 +0,0 @@ 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 );
|
||||
--
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren