From 67075e9350c7524d636e63cadf0a4a36ec1e6b3d Mon Sep 17 00:00:00 2001 From: Benjamin Fahl Date: Sat, 18 Jul 2026 18:24:57 +0200 Subject: [PATCH] fix(events): use infinite idle timeout so event listener never aborts The Docker event stream is long-lived and often silent for minutes. The event-stream HTTP client used 'timeout' => null, which falls back to the php.ini default_socket_timeout (60s). On idle the stream ended and listenForEvents() returned, so the CLI process exited; under a "restart: always" container that appeared as a restart every 60s. Set 'timeout' => -1 to disable the idle timeout, so the listener blocks until a real event or a genuine end-of-stream arrives. --- src/Client/DockerApiClientWrapper.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Client/DockerApiClientWrapper.php b/src/Client/DockerApiClientWrapper.php index f70674c..60cb075 100644 --- a/src/Client/DockerApiClientWrapper.php +++ b/src/Client/DockerApiClientWrapper.php @@ -43,7 +43,14 @@ public function listenForEvents(callable $eventCallback): void $client = $this->eventStreamClient ?? HttpClient::create([ 'base_uri' => $this->baseUri, 'bindto' => $this->socketPath, - 'timeout' => null, + // Infinite idle timeout. The Docker event stream is long-lived and + // often silent for minutes. A finite timeout (php.ini + // default_socket_timeout, 60s by default) ends the stream on idle, + // so listenForEvents() returns and the process exits — under a + // "restart: always" container that shows up as a restart every 60s. + // -1 disables the idle timeout, so the listener blocks until a real + // event or a genuine end-of-stream arrives. + 'timeout' => -1, ]); $serializer = new Serializer(