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

NoMethodError: undefined method `each' for nil #17

Open
histfak opened this issue Sep 8, 2024 · 0 comments
Open

NoMethodError: undefined method `each' for nil #17

histfak opened this issue Sep 8, 2024 · 0 comments

Comments

@histfak
Copy link

histfak commented Sep 8, 2024

I use Falcon with Sinatra and few times a day I see the following exception in the logs:

[2024-09-08 03:21:33] {"time":"2024-09-08T03:21:33+00:00","severity":"warn","oid":8160,"pid":5,"subject":"Async::Task","annotation":"Reading HTTP/1.1 requests for Async::HTTP::Protocol::HTTP1::Server.","message":"Task may have ended with unhandled exception.","event":{"type":"failure","root":"/usr/src/app","class":"NoMethodError","message":"\u001b[1mundefined method `each' for nil (\u001b[1;4mNoMethodError\u001b[m\u001b[1m)\u001b[m\n\n\u001b[1m\t\t\t\t\[email protected](&block)\u001b[m\n\u001b[1m\t\t\t\t\t ^^^^^\u001b[m","backtrace":["/usr/local/bundle/ruby/3.3.0/gems/protocol-rack-0.7.0/lib/protocol/rack/body/enumerable.rb:71:in `each'","/usr/local/bundle/ruby/3.3.0/gems/protocol-http1-0.22.0/lib/protocol/http1/connection.rb:313:in `write_fixed_length_body'","/usr/local/bundle/ruby/3.3.0/gems/protocol-http1-0.22.0/lib/protocol/http1/connection.rb:401:in `write_body'","/usr/local/bundle/ruby/3.3.0/gems/async-http-0.75.0/lib/async/http/protocol/http1/server.rb:96:in `block in each'","/usr/local/bundle/ruby/3.3.0/gems/async-2.17.0/lib/async/task.rb:318:in `defer_stop'","/usr/local/bundle/ruby/3.3.0/gems/async-http-0.75.0/lib/async/http/protocol/http1/server.rb:57:in `each'","/usr/local/bundle/ruby/3.3.0/gems/async-http-0.75.0/lib/async/http/server.rb:50:in `accept'","/usr/local/bundle/ruby/3.3.0/gems/io-endpoint-0.13.1/lib/io/endpoint/wrapper.rb:182:in `block (2 levels) in accept'","/usr/local/bundle/ruby/3.3.0/gems/async-2.17.0/lib/async/task.rb:197:in `block in run'","/usr/local/bundle/ruby/3.3.0/gems/async-2.17.0/lib/async/task.rb:422:in `block in schedule'"]}}

No sure if this is just a bad request or bug. Ruby version is 3.3.4 and YJIT is enabled globally via RUBYOPT.

Falcon configuration:

# frozen_string_literal: true

load :rack

hostname = File.basename(__dir__)
service hostname do
  include Falcon::Environment::Rack
  count ENV.fetch('WORKERS', 1).to_i

  preload 'preload.rb'
  cache true

  endpoint do
    Async::HTTP::Endpoint.parse("http://0.0.0.0:#{ENV.fetch('PORT',
                                                            80)}").with(protocol: Async::HTTP::Protocol::HTTP11)
  end
end
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

1 participant