Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lowlevel_error_handler called with EOFError even when there is no actual error #2416

Closed
iain opened this issue Oct 7, 2020 · 1 comment
Closed

Comments

@iain
Copy link

iain commented Oct 7, 2020

Describe the bug

This started happening in Puma 5. Even with a very simple success case, I am seeing EOFError being passed to the lowlevel_error_handler. It seems to be coming from inside puma itself. The output is ignored, because the actual request works fine.

Puma config:

The only thing is I specify is

# frozen_string_literal: true

lowlevel_error_handler do |ex, env, status|
  p ex
  puts(*ex.backtrace)
  p env
  p status
  [ status, {}, ["Internal Server Error #9"] ]
end

To Reproduce

Using a simple hello world app, it seems to be running fine from the client's perspective:

$ curl http://localhost:9292 -v
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 9292 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET / HTTP/1.1
> Host: localhost:9292
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Content-Length: 11
<
* Connection #0 to host localhost left intact
Hello World* Closing connection 0

However, in the server output I see the following:

Puma starting in single mode...
* Version 5.0.2 (ruby 2.7.1-p83), codename: Spoony Bard
* Min threads: 0, max threads: 5
* Environment: development
* Listening on http://0.0.0.0:9292
Use Ctrl-C to stop
#<EOFError: EOFError>
/Users/iain/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/puma-5.0.2/lib/puma/client.rb:170:in `try_to_finish'
/Users/iain/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/puma-5.0.2/lib/puma/reactor.rb:224:in `block in run_internal'
/Users/iain/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/puma-5.0.2/lib/puma/reactor.rb:157:in `each'
/Users/iain/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/puma-5.0.2/lib/puma/reactor.rb:157:in `run_internal'
/Users/iain/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/puma-5.0.2/lib/puma/reactor.rb:307:in `block in run_in_thread'
{"rack.version"=>[1, 6], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"puma 5.0.2 Spoony Bard", "GATEWAY_INTERFACE"=>"CGI/1.2", "puma.request_body_wait"=>0}\
500

In the env, QUERY_STRING and SCRIPT_NAME are never filled in, even if they are provided in the curl request.

Desktop (please complete the following information):

  • OS: macOS Catalina, ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
  • Puma Version: 5.0.2
  • rack: 2.2.3
@nateberkopec
Copy link
Member

Thanks for reporting. This is a duplicated of #2390.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants