Heroku上的NewRelic宝石崩溃应用程序

时间:2013-04-25 20:18:42

标签: ruby-on-rails deployment heroku newrelic

由于某种原因,我无法让我的应用程序在heroku上启动,当我尝试访问该网站时出现应用程序错误。得到以下错误:

/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `create_reflection' for #<Class:0x00000002cd3be0>

首次出现时,我添加了newrelic gem,版本3.6.0.83,并在更新为3.6.1.87时未修复。删除gem可以解决问题。

这是完整的堆栈跟踪:

2013-04-25T20:07:05.103138+00:00 heroku[slugc]: Slug compilation started
2013-04-25T20:08:31.370750+00:00 heroku[api]: Release v30 created by lobatifricha@gmail.com
2013-04-25T20:08:31.416852+00:00 heroku[api]: Deploy cdebc45 by lobatifricha@gmail.com
2013-04-25T20:08:31.967790+00:00 heroku[deployhooks]: Notified New Relic about the deploy
2013-04-25T20:08:32.438963+00:00 heroku[slugc]: Slug compilation finished
2013-04-25T20:08:33.740669+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RAILS_ENV -p 21046`
2013-04-25T20:08:31.500921+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-25T20:08:37.882708+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-25T20:08:37.882708+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Starting the New Relic agent in "production" environment.
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Reading configuration from config/newrelic.yml
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] WARN : Agent is configured not to use SSL when communicating with New Relic's servers
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Dispatcher: thin
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Environment: production
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the "production" section of your newrelic.yml.
2013-04-25T20:08:40.983660+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Installing Rails 3.1/3.2 view instrumentation
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Application: quickies
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Installing Rails 3 Controller instrumentation
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Installing Net instrumentation
2013-04-25T20:08:40.983322+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Installing ActiveRecord instrumentation
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/associations/builder/belongs_to.rb:14:in `build'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:502:in `load_missing_constant'
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/autosave_association.rb:139:in `build'
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/associations.rb:1431:in `belongs_to'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:192:in `block in const_missing'
2013-04-25T20:08:40.983660+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Installing Rails3 Error instrumentation
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/app/models/context.rb:1:in `<top (required)>'
2013-04-25T20:08:40.983660+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:40 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Starting Agent shutdown
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in `each'
2013-04-25T20:08:40.987527+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `create_reflection' for #<Class:0x00000002cd3be0> (NoMethodError)
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-25T20:08:40.983660+00:00 app[web.1]: ** [NewRelic][04/25/13 20:08:39 +0000 8a6f9f69-c49b-417d-b39a-d89256cf9f23 (2)] INFO : Finished instrumentation
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb:12:in `build'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:260:in `safe_constantize'
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/associations/builder/association.rb:25:in `build'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in `block in constantize'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in `require_or_load'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in `const_missing'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in `constantize'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/string/inflections.rb:66:in `safe_constantize'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/app/controllers/contexts_controller.rb:1:in `<top (required)>'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:152:in `_default_wrap_model'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:169:in `_set_wrapper_defaults'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-25T20:08:40.987527+00:00 app[web.1]:    from /app/app/models/context.rb:6:in `<class:Context>'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in `require_or_load'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2013-04-25T20:08:40.988968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
2013-04-25T20:08:40.987833+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in `each'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `each'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-04-25T20:08:40.988968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<main>'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `each'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from config.ru:1:in `new'
2013-04-25T20:08:40.988073+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:133:in `inherited'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `eager_load!'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from config.ru:1:in `<main>'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
2013-04-25T20:08:40.988307+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in `depend_on'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from config.ru:3:in `block in <main>'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2013-04-25T20:08:40.988749+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in `start'
2013-04-25T20:08:40.988528+00:00 app[web.1]:    from config.ru:3:in `require'
2013-04-25T20:08:40.988968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
2013-04-25T20:08:40.988968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
2013-04-25T20:08:42.284042+00:00 heroku[web.1]: Process exited with status 1
2013-04-25T20:08:42.303661+00:00 heroku[web.1]: State changed from starting to crashed

2 个答案:

答案 0 :(得分:4)

我在New Relic工作。我知道这是相当陈旧的,但我认为我会做出回应以防其他用户遇到同样的问题。

您看到的错误看起来像是我们在Ruby代理3.6.4版中修复的问题实例(请参阅this changelog entry)。

简单地说,根本原因是我们在生成有关运行应用程序的环境的报告时触发从后台线程加载ActiveRecord::Base导致的竞争条件。修复方法是恢复到之前的行为在主线程上生成此报告。

答案 1 :(得分:0)

看起来问题出在app/app/models/context.rb

来自日志:

2013-04-25T20:08:40.987527+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `create_reflection' for #<Class:0x00000002cd3be0> (NoMethodError)