From 4a6841a5a465c791b512517394241f0ac0b38739 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 25 Oct 2018 18:10:59 +0100 Subject: [PATCH] Added client side self rate-limiting for crashdump reporting this should produce some reduction in spam at the source. This could also be used to control the rate at which constantly-crashing servers restart to stop them spamming the disk as well, but the main concern here is eliminating crash archive involuntary DDoS by crashy servers. --- src/pocketmine/Server.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 11b5138f0..079686e25 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2196,6 +2196,14 @@ class Server{ if($this->getProperty("auto-report.enabled", true) !== false){ $report = true; + + $stamp = $this->getDataPath() . "crashdumps/.last_crash"; + $crashInterval = 120; //2 minutes + if(file_exists($stamp) and !($report = (filemtime($stamp) + $crashInterval < time()))){ + $this->logger->debug("Not sending crashdump due to last crash less than $crashInterval seconds ago"); + } + @touch($stamp); //update file timestamp + $plugin = $dump->getData()["plugin"]; if(is_string($plugin)){ $p = $this->pluginManager->getPlugin($plugin);