gpt4 book ai didi

ruby-on-rails - Heroku/Unicorn 上的重复出现 rails 错误 - 'execution expired',一个 ActionView::Template::Error

转载 作者:行者123 更新时间:2023-12-04 02:28:20 25 4
gpt4 key购买 nike

我的问题与以下类似,但发生在略有不同的情况下。

Rails: execution expired on time_zone_select

我的设置是:

  • rails 3.2.13
  • unicorn 4.6.2
  • Mongoid 3.0.22
  • 轻便摩托车 1.4.2

  • 在 Heroku Cedar 上运行。 MongoDB 托管在 MongoLab。

    错误是成批出现的,通常通过 Heroku 进程重新启动来解决。第一个通常是下面的:
    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'

    以下是堆栈跟踪的最高位。如果需要,很高兴添加更多!
    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 设置为 10 秒(我相信这是我读过的一个缓存教程所建议的)——如果答案是增加超时,那很好。但我想知道这是否不是一个缓慢的查询问题?这种行为似乎表明它只是挂起的 Unicorn 进程之一(这就是为什么 ps 重启似乎可以治愈它)。

    任何想法或提示将不胜感激!

    最佳答案

    我建议这是 heroku 文件或网络系统的问题。修改后的读取方法调用'Kernel::select。 Select it's self 是一个系统阻塞调用,它将等待 IO 对象变得可读。在这种情况下,是 TCP 端口与 MongoLab 建立外部连接。 TCP 端口变得不可读可能有多种原因。网络和文件问题浮现在脑海中。我怀疑这是一个长时间运行的查询,因为在运行查询期间套接字将是可读的,因为 select 不会阻止脚本执行。如果问题仍然存在,我会考虑远离 heroku 或其他网络上的外部数据库。 AWS 始终是一个不错的选择,因为它们在 boxen(boxes) 之间具有非常低的延迟。 HTH

    关于ruby-on-rails - Heroku/Unicorn 上的重复出现 rails 错误 - 'execution expired',一个 ActionView::Template::Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16741227/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com