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

NameError uninitialized constant using threaded server #229

Closed
jeffjo opened this issue Apr 24, 2017 · 21 comments
Closed

NameError uninitialized constant using threaded server #229

jeffjo opened this issue Apr 24, 2017 · 21 comments

Comments

@jeffjo
Copy link

jeffjo commented Apr 24, 2017

We are running:
rack-attack 4.2.0
rails 4.2.5.1
MRI ruby 2.3.1
puma 3.8.2

We are sometimes seeing NameError uninitialized constant Rack::Attack::Request when threading is enabled in Puma. I suspect this has something to do with the fact that rack-attack is using autoload. I came across this GH issue which describes what we're seeing. I was wondering if anyone else has encountered this kind of issue when running a multi-threaded web server.

@dhartoto
Copy link

Any resolution on this? We're getting this periodically as well. Same situation as above with the following versions:
rack-attack 5.0.1
rails 4.2.9
puma 3.9.1

@grzuy
Copy link
Collaborator

grzuy commented Jan 24, 2018

Hi there,

Created test rails app with:

  • rails 4.2.9
  • puma 3.9.1 (2 workers, 5 threads)
  • rack-attack 5.0.1 (with basic blocklist in config)
  • ruby 2.5.0

And tested with 10K (10 concurrent) requests using Apache Bench and wasn't able to reproduce the exception.

Here is the test app https://github.com/grzuy/rails_test_app_for_rack_attack_229, feel free to try make the error appear by adding any more configuration similar to what you have in yours :-)

@grzuy
Copy link
Collaborator

grzuy commented Jan 24, 2018

@dhartoto If you have a stack trace of the exception, that would be helpful also :-)

@dhartoto
Copy link

dhartoto commented Jan 25, 2018

Thanks @grzuy. This doesn't happen very often it only pops up once in awhile.
Here's the full stack trace:

vendor/bundle/ruby/2.3.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:137:in `call': uninitialized constant Rack::Attack::Request (NameError)
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
    from vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
    from vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/etag.rb:24:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/conditionalget.rb:25:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/head.rb:13:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/flash.rb:260:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:225:in `context'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:220:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/cookies.rb:560:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/query_cache.rb:36:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/rack/logger.rb:38:in `call_app'
    from vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/rack/logger.rb:20:in `block in call'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/tagged_logging.rb:68:in `block in tagged'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/tagged_logging.rb:26:in `tagged'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/tagged_logging.rb:68:in `tagged'
    from vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/rack/logger.rb:20:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/request_id.rb:21:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:122:in `block in call'
    from vendor/bundle/ruby/2.3.0/gems/rack-timeout-0.4.2/lib/rack/timeout/support/timeout.rb:19:in `timeout'
    from vendor/bundle/ruby/2.3.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:121:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/deflater.rb:35:in `call'
    from app/lib/deflater_with_exclusions.rb:12:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-zippy-3.0.1/lib/rack-zippy.rb:55:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/ssl.rb:24:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.1/lib/rack/cors.rb:81:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/engine.rb:518:in `call'
    from vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:165:in `call'
    from vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.3.0/gems/puma-3.9.1/lib/puma/configuration.rb:224:in `call'
    from vendor/bundle/ruby/2.3.0/gems/puma-3.9.1/lib/puma/server.rb:602:in `handle_request'
    from vendor/bundle/ruby/2.3.0/gems/puma-3.9.1/lib/puma/server.rb:435:in `process_client'
    from vendor/bundle/ruby/2.3.0/gems/puma-3.9.1/lib/puma/server.rb:299:in `block in run'
    from vendor/bundle/ruby/2.3.0/gems/puma-3.9.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

I'll have a play with your test app later today :)

@grzuy
Copy link
Collaborator

grzuy commented Jan 25, 2018

@dhartoto Thanks.

Are you adding anything to rails autoload_paths in your production configuration?

@grzuy
Copy link
Collaborator

grzuy commented Jan 30, 2018

@dhartoto Hi, i am still trying to reproduce this issue.

Maybe your config/puma.rb contents would be helpful, do you have one in your app?
Are you running on heroku? If so, what's on your Procfile?

Thanks again.

@dhartoto
Copy link

@grzuy so sorry for my late reply. Been caught up.
The only thing we're adding to rails autoload_paths is a lib folder.
Yes we're running on heroku. Would this be a problem?

Here's my puma config:

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

And my Procfile:

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -c ${SIDEKIQ_CONCURRENCY:-8} -C config/sidekiq.yml

@grzuy
Copy link
Collaborator

grzuy commented Jan 31, 2018

No, Heroku shouldn't be a problem at all.

I am just gathering info about you setup to see if that helps me, either reproduce the issue on my end and/or help me understand what could be happening.

Thanks!

@grzuy
Copy link
Collaborator

grzuy commented Jan 31, 2018

@dhartoto A couple of questions.

  1. Do you have Rack::Attack::Request re-defined in your app?
  2. Do you have any class/module named Request in your lib directory?

@dhartoto
Copy link

dhartoto commented Feb 1, 2018

@grzuy, the answer is no to both your questions.

@leofrozenyogurt
Copy link

we are getting the same issue
rack-attack (5.0.1)
rails (5.1.0)
puma (3.9.1)

@lmansur
Copy link
Contributor

lmansur commented Mar 9, 2018

@leofrozenyogurt could you also post your stack trace? Maybe we can converge to a common dependency between both of you.

@leofrozenyogurt
Copy link

vendor/bundle/ruby/2.4.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:136:in `call': uninitialized constant Rack::Attack::PathNormalizer
Did you mean?  Rack::Attack::PathNormalizer (NameError)
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/deflater.rb:34:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/remotipart-1.3.1/lib/remotipart/middleware.rb:32:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
    from vendor/bundle/ruby/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/conditional_get.rb:25:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/cookies.rb:613:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/callbacks.rb:97:in `run_callbacks'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-5.1.0/lib/rails/rack/logger.rb:36:in `call_app'
    from vendor/bundle/ruby/2.4.0/gems/railties-5.1.0/lib/rails/rack/logger.rb:24:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/tagged_logging.rb:69:in `block in tagged'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/tagged_logging.rb:26:in `tagged'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/tagged_logging.rb:69:in `tagged'
    from vendor/bundle/ruby/2.4.0/gems/railties-5.1.0/lib/rails/rack/logger.rb:24:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/quiet_assets.rb:13:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/request_id.rb:25:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:122:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/rack-timeout-0.4.2/lib/rack/timeout/support/timeout.rb:19:in `timeout'
    from vendor/bundle/ruby/2.4.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:121:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.0/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/executor.rb:12:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/static.rb:125:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/heroku-deflater-0.6.3/lib/heroku-deflater/skip_binary.rb:19:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/deflater.rb:34:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/heroku-deflater-0.6.3/lib/heroku-deflater/serve_zipped_assets.rb:54:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/font_assets-0.1.14/lib/font_assets/middleware.rb:17:in `block in call'
    from vendor/bundle/ruby/2.4.0/gems/font_assets-0.1.14/lib/font_assets/middleware.rb:40:in `do_request'
    from vendor/bundle/ruby/2.4.0/gems/font_assets-0.1.14/lib/font_assets/middleware.rb:16:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.0/lib/action_dispatch/middleware/ssl.rb:66:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-utf8_sanitizer-1.5.0/lib/rack/utf8_sanitizer.rb:22:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-cors-1.0.1/lib/rack/cors.rb:93:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/rack-cors-1.0.1/lib/rack/cors.rb:93:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/railties-5.1.0/lib/rails/engine.rb:522:in `call'
    from vendor/bundle/ruby/2.4.0/gems/newrelic_rpm-4.3.0.335/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.9.1/lib/puma/configuration.rb:224:in `call'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.9.1/lib/puma/server.rb:602:in `handle_request'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.9.1/lib/puma/server.rb:435:in `process_client'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.9.1/lib/puma/server.rb:299:in `block in run'
    from vendor/bundle/ruby/2.4.0/gems/puma-3.9.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

@lmansur
Copy link
Contributor

lmansur commented Mar 9, 2018

The stack traces are very similar. Here are the intersections:

NewRelic RPM 4.3.0.335
Warden 1.2.7
Rack Timeout 0.4.2
Rack Deflater

I'll see if I'm able to set up a testing app later tonight. Maybe you can use these gems in your test-app, @grzuy?

@lmansur
Copy link
Contributor

lmansur commented Mar 10, 2018

I've tested with NewRelic and Rack Timeout with no success.

I'm yet to set up Warden since it might take more time.

@leofrozenyogurt @dhartoto are you using some kind of Authentication lib that makes use of Warden, such as Devise?

@NuckChorris
Copy link

NuckChorris commented Mar 24, 2018

We're also seeing the issue with Rack::Attack::PathNormalizer at my company. We don't use New Relic, Warden, or Devise. We do use rack-timeout but it's a fork which doesn't kill the thread at timeout (it just logs it to Sentry) so that's not a likely culprit

Here's our stack trace:

NameError: uninitialized constant Rack::Attack::PathNormalizer
  from rack/attack.rb:139:in `call'
  from action_dispatch/middleware/remote_ip.rb:78:in `call'
  from action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  from action_dispatch/middleware/show_exceptions.rb:30:in `call'
  from chewy/railtie.rb:17:in `block in call'
  from chewy/strategy.rb:63:in `wrap'
  from chewy.rb:187:in `strategy'
  from chewy/railtie.rb:17:in `call'
  from lograge/rails_ext/rack/logger.rb:15:in `call_app'
  from rails/rack/logger.rb:20:in `block in call'
  from active_support/tagged_logging.rb:68:in `block in tagged'
  from active_support/tagged_logging.rb:26:in `tagged'
  from active_support/tagged_logging.rb:68:in `tagged'
  from rails/rack/logger.rb:20:in `call'
  from request_store/middleware.rb:19:in `call'
  from rack/timeout/core.rb:108:in `block in call'
  from rack/timeout/support/timeout.rb:19:in `timeout'
  from rack/timeout/core.rb:106:in `call'
  from action_dispatch/middleware/request_id.rb:21:in `call'
  from rack/methodoverride.rb:22:in `call'
  from rack/runtime.rb:18:in `call'
  from action_dispatch/middleware/static.rb:120:in `call'
  from flipper/middleware/memoizer.rb:64:in `memoized_call'
  from flipper/middleware/memoizer.rb:42:in `call'
  from rack/cors.rb:97:in `call'
  from raven/integrations/rack.rb:51:in `call'
  from librato/rack.rb:105:in `process_request'
  from librato/rack.rb:75:in `call'
  from rails/engine.rb:518:in `call'
  from rails/application.rb:165:in `call'
  from puma/configuration.rb:225:in `call'
  from puma/server.rb:624:in `handle_request'
  from puma/server.rb:438:in `process_client'
  from puma/server.rb:302:in `block in run'
  from puma/thread_pool.rb:120:in `block in spawn_thread'

@lmansur
Copy link
Contributor

lmansur commented Mar 24, 2018

@grzuy autoload is not thread safe. I'm starting to think it is the culprit here. You could release a version with the patch where you changed it for require and they can test it. What do you think?

@grzuy
Copy link
Collaborator

grzuy commented Mar 26, 2018

Hi @lmansur, the goal is is to have a new release sometime next week, if not before :-)

@grzuy
Copy link
Collaborator

grzuy commented Apr 6, 2018

@lmansur FWIW 5.2.0 has been released last week.

@grzuy
Copy link
Collaborator

grzuy commented Apr 6, 2018

@jeffjo @dhartoto @NuckChorris @leofrozenyogurt Please report back if you are also able to reproduce NameError: uninitialized constant Rack::Attack::PathNormalizer and/or NameError uninitialized constant Rack::Attack::Request errors with latest release 5.2.0.

Thanks!

@grzuy
Copy link
Collaborator

grzuy commented May 18, 2018

Closing for now.
Will re-open if we get a error report for this issue in 5.2.0.

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

No branches or pull requests

6 participants