mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
Fixed server not stopping after a special crash
This commit is contained in:
parent
cc7f12739d
commit
79bc1d6c85
@ -137,7 +137,7 @@ class CrashDump{
|
|||||||
$error = $lastExceptionError;
|
$error = $lastExceptionError;
|
||||||
}else{
|
}else{
|
||||||
$error = (array) error_get_last();
|
$error = (array) error_get_last();
|
||||||
$error["trace"] = getTrace(4);
|
$error["trace"] = @getTrace(4);
|
||||||
$errorConversion = [
|
$errorConversion = [
|
||||||
E_ERROR => "E_ERROR",
|
E_ERROR => "E_ERROR",
|
||||||
E_WARNING => "E_WARNING",
|
E_WARNING => "E_WARNING",
|
||||||
|
@ -1589,7 +1589,6 @@ class Server{
|
|||||||
|
|
||||||
set_exception_handler([$this, "exceptionHandler"]);
|
set_exception_handler([$this, "exceptionHandler"]);
|
||||||
register_shutdown_function([$this, "crashDump"]);
|
register_shutdown_function([$this, "crashDump"]);
|
||||||
register_shutdown_function([$this, "forceShutdown"]);
|
|
||||||
|
|
||||||
$this->pluginManager->loadPlugins($this->pluginPath);
|
$this->pluginManager->loadPlugins($this->pluginPath);
|
||||||
|
|
||||||
@ -1905,6 +1904,7 @@ class Server{
|
|||||||
$this->logger->emergency("Crashed while crashing, killing process");
|
$this->logger->emergency("Crashed while crashing, killing process");
|
||||||
@kill(getmypid());
|
@kill(getmypid());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2002,7 +2002,7 @@ class Server{
|
|||||||
"fullFile" => $e->getFile(),
|
"fullFile" => $e->getFile(),
|
||||||
"file" => $errfile,
|
"file" => $errfile,
|
||||||
"line" => $errline,
|
"line" => $errline,
|
||||||
"trace" => getTrace($trace === null ? 3 : 0, $trace)
|
"trace" => @getTrace($trace === null ? 3 : 0, $trace)
|
||||||
];
|
];
|
||||||
|
|
||||||
global $lastExceptionError, $lastError;
|
global $lastExceptionError, $lastError;
|
||||||
@ -2014,7 +2014,11 @@ class Server{
|
|||||||
if($this->isRunning === false){
|
if($this->isRunning === false){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ini_set("memory_limit", "-1"); //Fix error dump not dumped on memory problems
|
$this->isRunning = false;
|
||||||
|
$this->hasStopped = false;
|
||||||
|
|
||||||
|
ini_set("error_reporting", 0);
|
||||||
|
ini_set("memory_limit", -1); //Fix error dump not dumped on memory problems
|
||||||
$this->logger->emergency("An unrecoverable error has occurred and the server has crashed. Creating a crash dump");
|
$this->logger->emergency("An unrecoverable error has occurred and the server has crashed. Creating a crash dump");
|
||||||
$dump = new CrashDump($this);
|
$dump = new CrashDump($this);
|
||||||
|
|
||||||
@ -2022,19 +2026,21 @@ class Server{
|
|||||||
|
|
||||||
|
|
||||||
if($this->getProperty("auto-report.enabled", true) !== false){
|
if($this->getProperty("auto-report.enabled", true) !== false){
|
||||||
|
$report = true;
|
||||||
$plugin = $dump->getData()["plugin"];
|
$plugin = $dump->getData()["plugin"];
|
||||||
if(is_string($plugin)){
|
if(is_string($plugin)){
|
||||||
$p = $this->pluginManager->getPlugin($plugin);
|
$p = $this->pluginManager->getPlugin($plugin);
|
||||||
if($p instanceof Plugin and !($p->getPluginLoader() instanceof PharPluginLoader)){
|
if($p instanceof Plugin and !($p->getPluginLoader() instanceof PharPluginLoader)){
|
||||||
return;
|
$report = false;
|
||||||
}
|
}
|
||||||
}elseif(\Phar::running(true) == ""){
|
}elseif(\Phar::running(true) == ""){
|
||||||
return;
|
$report = false;
|
||||||
}
|
}
|
||||||
if($dump->getData()["error"]["type"] === "E_PARSE" or $dump->getData()["error"]["type"] === "E_COMPILE_ERROR"){
|
if($dump->getData()["error"]["type"] === "E_PARSE" or $dump->getData()["error"]["type"] === "E_COMPILE_ERROR"){
|
||||||
return;
|
$report = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($report){
|
||||||
$reply = Utils::postURL("http://" . $this->getProperty("auto-report.host", "crash.pocketmine.net") . "/submit/api", [
|
$reply = Utils::postURL("http://" . $this->getProperty("auto-report.host", "crash.pocketmine.net") . "/submit/api", [
|
||||||
"report" => "yes",
|
"report" => "yes",
|
||||||
"name" => $this->getName() . " " . $this->getPocketMineVersion(),
|
"name" => $this->getName() . " " . $this->getPocketMineVersion(),
|
||||||
@ -2048,12 +2054,13 @@ class Server{
|
|||||||
$this->logger->emergency("The crash dump has been automatically submitted to the Crash Archive. You can view it on $reportUrl or use the ID #$reportId.");
|
$this->logger->emergency("The crash dump has been automatically submitted to the Crash Archive. You can view it on $reportUrl or use the ID #$reportId.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//$this->checkMemory();
|
//$this->checkMemory();
|
||||||
//$dump .= "Memory Usage Tracking: \r\n" . chunk_split(base64_encode(gzdeflate(implode(";", $this->memoryStats), 9))) . "\r\n";
|
//$dump .= "Memory Usage Tracking: \r\n" . chunk_split(base64_encode(gzdeflate(implode(";", $this->memoryStats), 9))) . "\r\n";
|
||||||
|
|
||||||
$this->forceShutdown();
|
$this->forceShutdown();
|
||||||
kill(getmypid());
|
@kill(getmypid());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,9 +193,10 @@ class McRegion extends BaseLevelProvider{
|
|||||||
$chunk = $this->getChunk($x, $z, false);
|
$chunk = $this->getChunk($x, $z, false);
|
||||||
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
|
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
|
||||||
unset($this->chunks[Level::chunkHash($x, $z)]);
|
unset($this->chunks[Level::chunkHash($x, $z)]);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveChunk($x, $z){
|
public function saveChunk($x, $z){
|
||||||
|
@ -138,7 +138,7 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
$errfile = \pocketmine\cleanPath($errfile);
|
$errfile = \pocketmine\cleanPath($errfile);
|
||||||
$this->log($type, get_class($e).": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
|
$this->log($type, get_class($e).": \"$errstr\" ($errno) in \"$errfile\" at line $errline");
|
||||||
|
|
||||||
foreach(($trace = \pocketmine\getTrace($trace === null ? 4 : 0, $trace)) as $i => $line){
|
foreach(($trace = @\pocketmine\getTrace($trace === null ? 4 : 0, $trace)) as $i => $line){
|
||||||
$this->debug($line);
|
$this->debug($line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user