Rails 4.0 / Linode heisenbugs,part deux

时间:2014-07-20 19:16:25

标签: ruby-on-rails exception nokogiri heisenbug libxml-ruby

第1部分:Rails/Paperclip/S3 mystery errors: undefined method "global_endpoint?"

自从将应用程序从3.0升级到Rails 4.0并同时通过Linode最新的免费RAM升级运行其VPS之后,它一直在随意抛出无意义的异常。

这样的东西:

TypeError: wrong argument type Time (expected time)
/gems/newrelic_rpm-3.9.0.229/lib/new_relic/agent/transaction.rb:165 in "to_f"
/gems/newrelic_rpm-3.9.0.229/lib/new_relic/agent/transaction.rb:165 in "stop"
/gems/newrelic_rpm-3.9.0.229/lib/new_relic/agent/instrumentation/middleware_tracing.rb:63 in "call"
/gems/warden-1.2.3/lib/warden/manager.rb:35 in "block in call"
/gems/warden-1.2.3/lib/warden/manager.rb:34 in "catch"
/gems/warden-1.2.3/lib/warden/manager.rb:34 in "call"
/gems/newrelic_rpm-3.9.0.229/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57 in "call"
/gems/rack-1.5.2/lib/rack/etag.rb:23 in "call"
/gems/newrelic_rpm-3.9.0.229/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57 in "call"
/gems/rack-1.5.2/lib/rack/conditionalget.rb:25 in "call"
...

TypeError: wrong argument type Object (expected barrier)
/gems/devise-3.1.0/lib/devise/hooks/forgetable.rb:7 in "block in <top (required)>"
/gems/warden-1.2.3/lib/warden/hooks.rb:14 in "call"
/gems/warden-1.2.3/lib/warden/hooks.rb:14 in "block in _run_callbacks"
/gems/warden-1.2.3/lib/warden/hooks.rb:9 in "each"
/gems/warden-1.2.3/lib/warden/hooks.rb:9 in "_run_callbacks"
/gems/warden-1.2.3/lib/warden/manager.rb:53 in "_run_callbacks"
/gems/warden-1.2.3/lib/warden/proxy.rb:262 in "block in logout"
/gems/warden-1.2.3/lib/warden/proxy.rb:260 in "each"
/gems/warden-1.2.3/lib/warden/proxy.rb:260 in "logout"
/gems/devise-3.1.0/lib/devise/controllers/helpers.rb:155 in "sign_out"
/app/controllers/user_sessions_controller.rb:76 in "destroy"
/gems/actionpack-4.0.8/lib/action_controller/metal/implicit_render.rb:4 in "send_action"
...

NoMethodError: undefined method `_client' for <AWS::Core::Configuration>:AWS::Core::Configuration
/gems/aws-sdk-1.46.0/lib/aws/core/service_interface.rb:73 in "initialize"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:239 in "new"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:239 in "obtain_s3_instance_for"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:233 in "s3_interface"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:243 in "s3_bucket"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:247 in "s3_object"
/app/models/streaming_resource.rb:49 in "block in download_url"
/app/models/retryable.rb:13 in "call"
/app/models/retryable.rb:13 in "retry_this"
/app/models/streaming_resource.rb:48 in "download_url"
/app/views/streaming_resources/_sidebar_item.html.haml:47 in "_app_views_streaming_resources__sidebar_item_html_haml___57519138038974311_58831540"
/gems/actionpack-4.0.8/lib/action_view/template.rb:143 in "block in render"
/gems/activesupport-4.0.8/lib/active_support/notifications.rb:159 in "block in instrument"
...

NoMethodError: undefined method `key?' for nil:NilClass
/gems/activerecord-4.0.8/lib/active_record/core.rb:439 in "init_internals"
/gems/activerecord-4.0.8/lib/active_record/core.rb:206 in "init_with"
/gems/activerecord-4.0.8/lib/active_record/persistence.rb:52 in "instantiate"
/gems/activerecord-4.0.8/lib/active_record/querying.rb:45 in "block in find_by_sql"
/gems/activerecord-4.0.8/lib/active_record/result.rb:21 in "block in each"
/gems/activerecord-4.0.8/lib/active_record/result.rb:21 in "each"
/gems/activerecord-4.0.8/lib/active_record/result.rb:21 in "each"
/gems/activerecord-4.0.8/lib/active_record/querying.rb:45 in "map"
/gems/activerecord-4.0.8/lib/active_record/querying.rb:45 in "find_by_sql"
/gems/activerecord-4.0.8/lib/active_record/relation.rb:587 in "exec_queries"
/gems/activerecord-4.0.8/lib/active_record/relation.rb:471 in "load"
/gems/activerecord-4.0.8/lib/active_record/relation.rb:220 in "to_a"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "block in associated_records_by_owner"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "each"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "each_slice"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "each"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "map"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:80 in "associated_records_by_owner"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/collection_association.rb:13 in "preload"
/gems/activerecord-4.0.8/lib/active_record/associations/preloader/association.rb:19 in "run"
...

NoMethodError: undefined method `active=' for nil:NilClass
/gems/haml-4.1.0.beta.1/lib/haml/helpers.rb:91 in "ensure in non_haml"
/gems/haml-4.1.0.beta.1/lib/haml/helpers.rb:91 in "non_haml"
/gems/haml-4.1.0.beta.1/lib/haml/helpers/action_view_mods.rb:10 in "render_with_haml"
/app/views/layouts/lessons.html.haml:8 in "_app_views_layouts_lessons_html_haml___660540921921171033_52318960"
/gems/actionpack-4.0.8/lib/action_view/template.rb:143 in "block in render"
/gems/activesupport-4.0.8/lib/active_support/notifications.rb:159 in "block in instrument"
/gems/activesupport-4.0.8/lib/active_support/notifications/instrumenter.rb:20 in "instrument"
/gems/activesupport-4.0.8/lib/active_support/notifications.rb:159 in "instrument"
/gems/actionpack-4.0.8/lib/action_view/template.rb:141 in "render"
/gems/actionpack-4.0.8/lib/action_view/renderer/template_renderer.rb:61 in "render_with_layout"
/gems/actionpack-4.0.8/lib/action_view/renderer/template_renderer.rb:47 in "render_template"
/gems/actionpack-4.0.8/lib/action_view/renderer/template_renderer.rb:17 in "render"
/gems/actionpack-4.0.8/lib/action_view/renderer/renderer.rb:42 in "render_template"
/gems/actionpack-4.0.8/lib/action_view/renderer/renderer.rb:23 in "render"
/gems/actionpack-4.0.8/lib/abstract_controller/rendering.rb:127 in "_render_template"
/gems/actionpack-4.0.8/lib/action_controller/metal/streaming.rb:219 in "_render_template"
...

ArgumentError: 'false' is not an ActiveModel-compatible object. It must implement :to_partial_path.
/gems/actionpack-4.0.5/lib/action_view/renderer/partial_renderer.rb:436 in "partial_path"
/gems/actionpack-4.0.5/lib/action_view/renderer/partial_renderer.rb:345 in "setup"
/gems/actionpack-4.0.5/lib/action_view/renderer/partial_renderer.rb:262 in "render"
/gems/actionpack-4.0.5/lib/action_view/renderer/renderer.rb:47 in "render_partial"
/gems/actionpack-4.0.5/lib/action_view/helpers/rendering_helper.rb:27 in "render"
/gems/haml-4.1.0.beta.1/lib/haml/helpers/action_view_mods.rb:10 in "block in render_with_haml"
/gems/haml-4.1.0.beta.1/lib/haml/helpers.rb:89 in "non_haml"
/gems/haml-4.1.0.beta.1/lib/haml/helpers/action_view_mods.rb:10 in "render_with_haml"
/app/views/streaming_resources/_sidebar.html.haml:8 in "block in _app_views_streaming_resources__sidebar_html_haml___2619518895430049510_59147280"
/gems/activerecord-4.0.5/lib/active_record/relation/delegation.rb:13 in "each"
/gems/activerecord-4.0.5/lib/active_record/relation/delegation.rb:13 in "each"
/app/views/streaming_resources/_sidebar.html.haml:7 in "_app_views_streaming_resources__sidebar_html_haml___2619518895430049510_59147280"
/gems/actionpack-4.0.5/lib/action_view/template.rb:143 in "block in render"
/gems/activesupport-4.0.5/lib/active_support/notifications.rb:159 in "block in instrument"
/gems/activesupport-4.0.5/lib/active_support/notifications/instrumenter.rb:20 in "instrument"
/gems/activesupport-4.0.5/lib/active_support/notifications.rb:159 in "instrument"
...

以前都没有发生过这些错误,并且从未在开发或登台环境中发生过。我无法重新创建它们。他们会在模特的#show视图中出现一半的时间,但随后重新加载页面就可以了。它可能会在每10到100次视图中出现一次。

我对如何继续或调试感到茫然。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

解决了!只花了一年半的时间搜索!结果证明它与libxml-ruby gem中的一些坏内存钩子有关。见这里:

https://github.com/sparklemotion/nokogiri/issues/881 https://github.com/sparklemotion/nokogiri/issues/1364

从我的Gemfile中删除libxml-ruby修复了它。