2013-10-21 17 views
3

我有一個與獨角獸服務器Heroku的Rails網站。我偶爾會通知我的錯誤,如下列之一:如何解決Rails中執行過期錯誤?

ActionView::Template::Error: execution expired
(in /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` 

回答

2

如果這實際上是通過渲染的application.js引起的,你可能設法關閉資產預編譯,因爲否則該文件將被預編譯,只是一個文件來服務哪個可以幾乎沒有時間了。

檢查資產預編譯並重新啓用它,如果它真的被禁用。

如果情況並非如此,文件可能非常龐大,如果您實際使用JavaScript資源文件夾中的所有內容,則應重新考慮。

+0

推送到Heroku時出現以下消息「預編譯資產失敗,啓用運行時資產編譯」,但不應該隻影響首次訪問該網站? – Ari

+0

不一定。 Heroku常常會關閉你的實例並啓動一個新的實例,然後緩存的文件就會消失。這就是說,如果它甚至將其緩存在文件中,而不僅僅是存儲在內存中,這會使其變得更加不穩定。 – CMW

+0

固定資產預編譯的兩種方法都可能解決您的問題。 – CMW

相關問題