heroku / barnes

Tell StatsD about request time, GC, objects and more. Latest Rails 4 and Ruby 2.1 support, and ancient Rails 2 and Ruby 1.8 support.
MIT License
0 stars 0 forks source link

Undefined method 'new' for Statsd:Module (NoMethodError) on Puma start #21

Closed mushfick closed 4 years ago

mushfick commented 5 years ago

Hello, I'm getting this error when I try to start my rails server:

/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/barnes-0.0.7/lib/barnes.rb:47:in `start': undefined method `new' for Statsd:Module (NoMethodError)
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/barnes-0.0.7/lib/barnes/railtie.rb:44:in `block in <class:Railtie>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:347:in `each'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:347:in `call'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
/config/environment.rb:5:in `<top (required)>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
/config.ru:3:in `block in <main>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
/config.ru:in `new'
/config.ru:in `<main>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:124:in `log_to_stdout'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:77:in `start'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
/bin/rails:9:in `require'
/bin/rails:9:in `<top (required)>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/.rbenv/versions/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

Also, in IRB when I do:

require 'statsd'

Statsd.new(....)

it works without raising any errors.

Would appreciate any help in resolving this issue. Thank you.

schneems commented 4 years ago

Are you still seeing this? Can you give me an example app that reproduces the issue? https://www.codetriage.com/example_app

mushfick commented 4 years ago

Na, I'm good. Thanks. I don't even remember what I did to fix it but something worked. Appreciate you checking in.