From 091f5dc1956ec3a34f453fc6d39695da1ba9478d Mon Sep 17 00:00:00 2001 From: Brian John Date: Fri, 2 Aug 2024 16:36:24 -0500 Subject: [PATCH] Fix #724 This fixes an issue where, when the Spring client times out or otherwise disconnects from the server, that the server crashes with a `Broken pipe (Errno::EPIPE)` error. --- CHANGELOG.md | 2 ++ lib/spring/server.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccacc975..8263a7e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Next Release +* Fixed Server crash when the Client times out or otherwise disconnects + ## 4.2.1 * Added `Spring.connect_timeout` and `Spring.boot_timeout` to allow to increase timeout for larger apps. diff --git a/lib/spring/server.rb b/lib/spring/server.rb index 6eae1ea8..1c6901a5 100644 --- a/lib/spring/server.rb +++ b/lib/spring/server.rb @@ -74,6 +74,8 @@ def serve(client) end rescue SocketError => e raise e unless client.eof? + rescue Errno::EPIPE => e + log "client disconnected with error #{e.message}, ignoring command" ensure redirect_output end