pmmp / PcntlSignalHandler

[deprecated] PocketMine-MP plugin to allow stopping the server gracefully using CTRL+C
GNU Lesser General Public License v3.0
3 stars 1 forks source link

The child process failed to read the command when use CTRL+C to kill the server #3

Closed Blackjack200 closed 3 years ago

Blackjack200 commented 3 years ago
  1. start up a server with this plugin
  2. press CTRL+C
  3. see error
    ^C
    Fatal error: Uncaught pocketmine\utils\AssumptionFailedError: Something has gone horribly wrong in pmsrc/src/console/ConsoleReaderThread.php:107
    Stack trace:
    #0 pmsrc/src/thread/CommonThreadPartsTrait.php(93): pocketmine\console\ConsoleReaderThread->onRun()
    #1 [internal function]: pocketmine\thread\Thread->run()
    #2 {main}
    thrown in pmsrc/src/console/ConsoleReaderThread.php on line 107

PM version: https://github.com/pmmp/PocketMine-MP/commit/1afda04620606e49cd4a8eeb04d08ff3908f2da4 Plugin version: 1665d7ff2dd411de48f81f3597a536d9e1bac27c

PHP: 7.4.20 JIT: NO OS: MacOS Catalina Plugins: DevTools v1.15.0+dev, PcntlSignalHandler v0.1.0

dktapps commented 3 years ago

I guess the child process handles the stop signal as a normal process would, while the server process is handling it differently (because of the plugin). Otherwise, you wouldn't see any error.

I'm not sure what the proper solution for this is. I guess a null-routed signal handler should be installed in the subprocess to prevent this from happening - the child process should anyway only stop when the parent process goes away.