首页 文章

如何修复Rails中的执行过期错误?

提问于
浏览
3

我有一个关于Heroku的Rails网站和Unicorn服务器 . 我偶尔会收到有关以下错误的通知:

ActionView :: Template ::错误:执行过期(在/app/app/assets/javascripts/application.js中)

这是我的application.js文件:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree
//= require jquery.qtip.js

错误日志未明确显示导致此类错误的原因 . 例如,最近的日志如下所示 . 可能导致此类错误的原因,或者我应该如何诊断它们?

独角兽配置:

# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
#...

捕捉超时:

#timeout.rb
Rack::Timeout.timeout = 13

日志:

app/web.2:  Started GET "/articles/20" for ...
heroku/web.1:  Cycling 
heroku/web.1:  Stopping all processes with SIGTERM 
app/web.1:  Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT 
app/web.1:  Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT 
app/web.1:  Unicorn master intercepting TERM and sending myself QUIT instead 
heroku/router:  at=info method=GET path=/articles/20 host=... dyno=web.2 connect=1ms service=79ms status=200 bytes=8123 
app/web.1:  I,  INFO -- : reaped # worker=0 
app/web.1:  I,  INFO -- : reaped # worker=2 
app/web.1:  I,  INFO -- : reaped # worker=1 
app/web.1:  I,  INFO -- : master complete 
heroku/web.1:  Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM 
heroku/web.1:  Stopping remaining processes with SIGKILL 
heroku/web.1:  Process exited with status 137 
heroku/web.1:  State changed from up to down 
heroku/web.1:  State changed from down to starting 
heroku/web.1:  Starting process with command `bundle exec unicorn -p 14131 -c ./config/unicorn.rb`

1 回答

  • 2

    如果这实际上是由渲染application.js引起的,那么您可能设法关闭资产预编译,因为否则该文件将被预编译并且只是一个服务的文件,几乎不会超时 .

    检查资产预编译并重新启用它(如果实际已禁用) .

    如果不是这种情况,那么文件可能非常庞大,如果你实际使用了javascripts资产文件夹中的所有内容,你应该重新考虑 .

相关问题