ruby-on-rails - Heroku 上的 NewRelic gem 崩溃应用程序

标签 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

最佳答案

我在 New Relic 工作。我知道这已经很老了,但我想如果其他用户遇到同样的问题,我会做出回应。

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

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

关于ruby-on-rails - Heroku 上的 NewRelic gem 崩溃应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16223983/

相关文章:

git - Visual Studio Online 计划生成找不到我的分支

sql - VSTS 构建不会拾取 dacpac 文件(云中的托管代理)

ruby-on-rails - shared_children 不在 Capistrano 3 中工作

node.js - 如何安排 worker 在 Heroku 中每 x 小时运行一次?

ruby-on-rails - Rails - 事件模型序列化序列化程序中的哈希数组

ruby-on-rails - rails 发行说明或变更日志在哪里

ruby-on-rails - Mailgun 沙盒域不起作用

python - 我可以使用 Heroku 作为 Python 服务器吗?

ruby-on-rails - 如何使 Ruby 与 bash 兼容

ruby-on-rails - 删除 ActiveRecord 模型时要求用户确认