From bc0433e356a6183b3cbefa48684b391b63e1cc5c Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 12 Sep 2026 13:57:00 +0200 Subject: [PATCH] Fix puzzle-relay exiting immediately on Linux: force start command Worker::runAll() parses start/stop/restart/... off the real \$argv on Linux - which here is Symfony console's own arguments (bin/console app:puzzle-relay), not a command it recognizes, so it printed its usage text and exited on every boot, and Docker kept restarting it forever. Windows skips that argv parsing entirely, which is why this never showed up locally. Worker::\$command = 'start' is Workerman's own mechanism for exactly this "used as a library" case - it appends to what getArgv() returns without touching the real \$argv. Co-Authored-By: Claude Sonnet 5 --- src/Command/PuzzleRelayCommand.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Command/PuzzleRelayCommand.php b/src/Command/PuzzleRelayCommand.php index a654656..71e66af 100644 --- a/src/Command/PuzzleRelayCommand.php +++ b/src/Command/PuzzleRelayCommand.php @@ -66,6 +66,15 @@ final class PuzzleRelayCommand extends Command Worker::$logFile = $logDir.'/puzzle-relay.log'; Worker::$pidFile = $logDir.'/puzzle-relay.pid'; Worker::$stdoutFile = $logDir.'/puzzle-relay-stdout.log'; + // On Linux, Worker::runAll() parses start/stop/restart/... off the + // real $argv - which here holds Symfony console's own arguments + // (bin/console app:puzzle-relay), not a command it recognizes, so it + // printed its usage text and exited immediately. This is Workerman's + // own escape hatch for exactly that: getArgv() appends $command's + // words to $argv before parsing, without touching $argv itself. + // (Windows skips this argv parsing entirely, which is why local dev + // never hit it.) + Worker::$command = 'start'; $worker = new Worker("websocket://{$this->listenAddress}"); $worker->onConnect = static function (TcpConnection $connection): void {