Search code examples
ruby-on-rails-3.1ruby-1.9.2newrelic

Rails server won't start because of new relic error


When I try to start my Rails server, I am getting the following error:

I am using ruby 1.9.2

 => Booting WEBrick 
 => Rails 3.1.8 application starting in development on http://0.0.0.0:3000
 => Call with -d to detach
 => Ctrl-C to shutdown server
/Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/newrelic_rpm-3.4.2/lib/new_relic/agent/agent.rb:318:in `log_app_names': undefined method `join' for nil:NilClass (NoMethodError)
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/newrelic_rpm-3.4.2/lib/new_relic/agent/agent.rb:439:in `start'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/newrelic_rpm-3.4.2/lib/new_relic/control/instance_methods.rb:95:in `start_agent'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/newrelic_rpm-3.4.2/lib/new_relic/control/instance_methods.rb:83:in `init_plugin'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/newrelic_rpm-3.4.2/lib/newrelic_rpm.rb:36:in `block in <class:Railtie>'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/toptier/Desktop/Proyectos/CursoIngles/config/environment.rb:5:in `<top (required)>'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /Users/toptier/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'

It is using the following gem: newrelic_rpm (3.4.2). If I comment newrelic line in gemfile it works well,

Any idea?


Solution

  • I work at New Relic and we've tracked down the problem.

    This happens when nil is explicitly set as the app name, which typically happens for local development of heroku apps that pull their app name from ENV["NEW_RELIC_APP_NAME"]. Since this environment variable is not typically set on your local dev box it comes into the agent's config as nil and crashes the local server. It doesn't effect deployed versions of the app where this variable is set.

    Obviously the agent should handle this case gracefully, and we'll have a patch out in the next day or two. We just completed a major refactoring of the agent's configuration, and this edge case was missed in our internal testing.

    etoleb gives a good workaround in the comment. We're very sorry for causing you this headache.

    If you have any questions or concerns feel free to email me directly at [email protected].

    Thanks!