zombocom / zombocom/rack-timeout
Puma and rack-timeout results in a null pointer after running for some time
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 922
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
We recently tried introducing request timeouts for our Rails application using this gem. While this setup works for some time, we run into a null pointer exception at some point:
NoMethodError: undefined method `state=' for nil:NilClass
_set_state! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/core.rb:193
call at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/core.rb:123
call at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/core.rb:125
run! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:39
run! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:52
run_loop! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:100
each at org/jruby/RubyArray.java:1865
run_loop! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:100
loop at org/jruby/RubyKernel.java:1507
run_loop! at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:81
runner at /usr/local/bundle/gems/rack-timeout-0.6.3/lib/rack/timeout/support/scheduler.rb:73
So it appears that the env either no longer holds the state or never held it in the first place.
Our setup is as follows:
- JRuby 9.3.4.0
- Rails 6.1.7.2
- Puma 6.2.1
Any help would be very much appreciated
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing _set_state! and call in lib/rack/timeout/core.rb, then follow the scheduler flow in lib/rack/timeout/support/scheduler.rb. Reproduce the failure with the reported JRuby, Rails, Puma, and rack-timeout versions, and determine why the request environment lacks the expected state. Done means the null-state path is understood and the timeout flow no longer raises this exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100