简体   繁体   English

Heroku / Unicorn上的重复导轨错误 - '执行过期',一个ActionView :: Template :: Error

[英]Recurring rails error on Heroku/Unicorn - 'execution expired', an ActionView::Template::Error

My question is similar to the following, but is happening under slightly different circumstances. 我的问题类似于以下内容,但情况略有不同。

Rails: execution expired on time_zone_select Rails:执行在time_zone_select上过期

My setup is: 我的设置是:

  • Rails 3.2.13 Rails 3.2.13
  • Unicorn 4.6.2 Unicorn 4.6.2
  • Mongoid 3.0.22 Mongoid 3.0.22
  • Moped 1.4.2 轻便摩托车1.4.2

Running on Heroku Cedar. 在Heroku Cedar上运行。 MongoDB is hosted at MongoLab. MongoDB在MongoLab上托管。

The errors come in batches and are often solved by a Heroku process restart. 错误分批进行,并且通常由Heroku进程重启来解决。 The first is usually the one below: 第一个通常是下面的那个:

An ActionView::Template::Error occurred in [controller]#[action]:

 execution expired
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/sockets/connectable.rb:46:in `read'

The following is the top bit of the stack trace. 以下是堆栈跟踪的最高位。 Happy to add more if needed! 如果需要,很乐意添加更多!

vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/sockets/connectable.rb:46:in `read'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/sockets/connectable.rb:46:in `block in read'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/sockets/connectable.rb:118:in `handle_socket_errors'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/sockets/connectable.rb:46:in `read'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:177:in `read_data'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:99:in `block in read'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:202:in `with_connection'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:97:in `read'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/protocol/query.rb:163:in `receive_replies'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:135:in `block in receive_replies'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:134:in `map'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/connection.rb:134:in `receive_replies'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:553:in `block (2 levels) in flush'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:129:in `ensure_connected'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:551:in `block in flush'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:566:in `logging'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:550:in `flush'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:539:in `process'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/node.rb:349:in `query'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/cursor.rb:138:in `block in load_docs'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/session/context.rb:105:in `block in with_node'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/cluster.rb:250:in `with_secondary'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/session/context.rb:104:in `with_node'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/cursor.rb:137:in `load_docs'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/cursor.rb:25:in `each'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/query.rb:76:in `each'
 vendor/bundle/ruby/1.9.1/gems/moped-1.4.2/lib/moped/query.rb:76:in `each'
 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.22/lib/mongoid/contextual/mongo.rb:132:in `block in each'
 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.22/lib/mongoid/contextual/mongo.rb:556:in `selecting'
 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.22/lib/mongoid/contextual/mongo.rb:131:in `each'
 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.22/lib/mongoid/contextual.rb:18:in `each'

Rack::Timeout is set for 10 seconds (I believe that was suggested by one of the caching tutorials I read) -- if the answer is to increase the timeout, that's fine. Rack :: Timeout设置为10秒(我相信这是我读过的一个缓存教程的建议) - 如果答案是增加超时,那很好。 But I wonder if this isn't a slow query issue? 但我想知道这不是一个缓慢的查询问题? The behavior seems to indicate that it's just one of the Unicorn processes that gets hung up (which is why a ps restart seems to cure it). 这种行为似乎表明它只是一个挂起的Unicorn进程(这就是为什么ps重启似乎可以治愈它)。

Any thoughts or tips would be hugely appreciated! 任何想法或提示将非常感谢!

I would suggest this is an issue with heroku's file or network system. 我建议这是heroku的文件或网络系统的问题。 The modped read method calls' Kernel::select. modped read方法调用'Kernel :: select。 Select it's self is a system blocking call that will wait for IO objects to become readable. 选择它的self是一个系统阻塞调用,它将等待IO对象变为可读。 In this case it's the TCP port that makes the external connection to MongoLab. 在这种情况下,它是与MongoLab建立外部连接的TCP端口。 There could be any number of reasons for the TCP port to be come unreadable. TCP端口可能有多种原因无法读取。 Networking and file issues come to mind. 脑海中浮现出网络和文件问题。 I doubt it's a long running query as the socket would be readable during the running of the query there for select would not block the script execution. 我怀疑这是一个长时间运行的查询,因为套接字在查询运行期间是可读的,因为select不会阻止脚本执行。 If the issue persists I would consider moving away from heroku or perhaps an external database on a different network. 如果问题仍然存在,我会考虑远离heroku或者可能是不同网络上的外部数据库。 AWS is always a good choice as they have very low latency between boxen(boxes). AWS始终是一个不错的选择,因为它们在盒子(盒子)之间具有非常低的延迟。 HTH HTH

尝试在您的Gemfile中将ruby版本设置为1.9.3,然后再次捆绑,提交和部署

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM