ruby-on-rails – Rails:执行在time_zone_select上过期
以下异常间歇性地出现:
An ActionView::Template::Error occurred execution expired vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' 这是完整的痕迹: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.37/lib/tzinfo/timezone.rb:103:in `get' vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.37/lib/tzinfo/timezone_proxy.rb:80:in `real_timezone' vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.37/lib/tzinfo/timezone_proxy.rb:52:in `period_for_utc' vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.37/lib/tzinfo/timezone.rb:458:in `current_period' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/object/try.rb:36:in `try' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:212:in `utc_offset' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:226:in `<=>' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:334:in `sort' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:334:in `all' vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/helpers/form_options_helper.rb:507:in `time_zone_options_for_select' vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/helpers/form_options_helper.rb:612:in `to_time_zone_select_tag' vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/helpers/form_options_helper.rb:277:in `time_zone_select' vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/helpers/form_options_helper.rb:654:in `time_zone_select' 当我导航到相关页面时,它加载正常.它似乎对大多数人来说很好,并且只是间歇地(很少)像这样崩溃.我注意到,只要它发生,用户代理就是机器人;最新的是Mozilla / 5.0(兼容; Baiduspider / 2.0; http://www.baidu.com/search/spider.html).但是我担心它有一天会发生在人类身上,所以我想知道是否有人知道我能做些什么呢? 更新 今天就出现了,用户已登录(幸运的是,该用户是我……虽然无法复制它). execution expired vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:15:in `visit' 跟踪: vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:15:in `visit' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:5:in `accept' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:36:in `block in visit_Psych_Nodes_Sequence' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:36:in `each' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:36:in `visit_Psych_Nodes_Sequence' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:15:in `visit' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:5:in `accept' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:26:in `block in visit_Psych_Nodes_Document' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:26:in `each' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:26:in `visit_Psych_Nodes_Document' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:15:in `visit' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:5:in `accept' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:20:in `block in visit_Psych_Nodes_Stream' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:20:in `each' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/emitter.rb:20:in `visit_Psych_Nodes_Stream' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:15:in `visit' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/visitors/visitor.rb:5:in `accept' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/nodes/node.rb:46:in `yaml' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych.rb:243:in `dump' vendor/bundle/ruby/1.9.1/gems/psych-1.3.4/lib/psych/core_ext.rb:14:in `psych_to_yaml' /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:110:in `to_yaml' vendor/bundle/ruby/1.9.1/gems/dalli-delete-matched-1.1.0/lib/dalli-delete-matched.rb:13:in `write_entry' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry' vendor/bundle/ruby/1.9.1/gems/dalli-2.6.2/lib/active_support/cache/dalli_store.rb:102:in `block in write' vendor/bundle/ruby/1.9.1/gems/dalli-2.6.2/lib/active_support/cache/dalli_store.rb:279:in `block in instrument' vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:125:in `instrument' vendor/bundle/ruby/1.9.1/gems/dalli-2.6.2/lib/active_support/cache/dalli_store.rb:279:in `instrument' vendor/bundle/ruby/1.9.1/gems/dalli-2.6.2/lib/active_support/cache/dalli_store.rb:101:in `write' vendor/bundle/ruby/1.9.1/gems/dalli-2.6.2/lib/active_support/cache/dalli_store.rb:78:in `fetch' app/models/concerns/roleable.rb:11:in `roles' 再次,任何见解都会非常受欢迎! 我在Heroku上主持这个,并按照https://blog.heroku.com/archives/2013/2/27/unicorn_rails的说明使用Unicorn 解决方法
回答这个问题:
你可以开始挽救这个错误,记录它,发送一封电子邮件给你,因为它只发生了几次,重试(使用“重试”命令).在此之后,您可能希望检查此IP执行的最后操作,并查看它是否相关.日志还记录会话变量. 也许你在高服务器使用时遇到了超时 – 尝试使用一个工具,使用一个新的,甚至可以自己记录内存使用情况,CPU使用率和磁盘使用情况以及其他信息. 编辑: 由于它不仅仅是一个动作,您可以像这样获取ApplicationController上的每个错误: class ApplicationController < ActionController::Base rescue_from MyException,:with => :handle_my_exception def handle_my_exception grab_data send_mail retry end end 我认为这是一个特定的动作,所以我不确定重试是否适用于此.但即使你不能重试,你仍然可以通过这种方式获得更多信息并通过电子邮件发送给自己.当然,您需要添加重试计数器逻辑,否则您将遇到麻烦. 再次编辑: 更好地思考,您可以使用基于请求参数的redirect_to来模拟从那里重试.在这个答案中,他解释了如何得到它.别忘了发送参数. How do I get the current absolute URL in Ruby on Rails? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |