diff --git a/test/test_puma_server.rb b/test/test_puma_server.rb index 3588dc939e..ed68b47523 100644 --- a/test/test_puma_server.rb +++ b/test/test_puma_server.rb @@ -1103,4 +1103,26 @@ def test_accept_econnaborted stub_accept_nonblock(error) assert_empty @events.stderr.string end + + # see https://github.com/puma/puma/issues/2390 + # fixed by https://github.com/puma/puma/pull/2279 + # + def test_client_quick_close_no_lowlevel_error_handler_call + handler = ->(err, env, status) { + @events.stdout.write "LLEH #{err.message}" + [500, {"Content-Type" => "application/json"}, ["{}\n"]] + } + + @server = Puma::Server.new @app, @events, {:lowlevel_error_handler => handler} + + server_run app: ->(env) { [200, {}, ['Hello World']] } + + sock = TCPSocket.new @host, @port + # normal request doesn't generate EOFError + sock.syswrite "GET / HTTP" + sock.close + + sleep 0.7 # need some delay for the lleh to be called + assert_empty @events.stdout.string + end end