diff --git a/History.md b/History.md index 3dd886937a..e5ef9e60ab 100644 --- a/History.md +++ b/History.md @@ -7,6 +7,7 @@ * Prevent connections from entering Reactor after shutdown begins (#2377) * Better error handling during force shutdown (#2271) * Fix LoadError in CentOS 8 (#2381) + * Do not log EOFError when a client connection is closed without write (#2384) * Refactor * Change Events#ssl_error signature from (error, peeraddr, peercert) to (error, ssl_socket) (#2375) diff --git a/lib/puma/client.rb b/lib/puma/client.rb index 1b7c0ea018..f783bc42ee 100644 --- a/lib/puma/client.rb +++ b/lib/puma/client.rb @@ -155,7 +155,9 @@ def try_to_finish data = @io.read_nonblock(CHUNK_SIZE) rescue IO::WaitReadable return false - rescue SystemCallError, IOError, EOFError + rescue EOFError + # Swallow error, don't log + rescue SystemCallError, IOError raise ConnectionError, "Connection error detected during read" end diff --git a/lib/puma/server.rb b/lib/puma/server.rb index 804011e3ca..a6095c49e5 100644 --- a/lib/puma/server.rb +++ b/lib/puma/server.rb @@ -246,7 +246,11 @@ def run(background=true) client.close @events.parse_error e, client - rescue ConnectionError, EOFError, ThreadPool::ForceShutdown => e + rescue EOFError => e + client.close + + # Swallow, do not log + rescue ConnectionError, ThreadPool::ForceShutdown => e client.close @events.connection_error e, client