Thursday, September 22, 2011

Why? heroku[router]: Error H12 (Request timeout)

Those of you getting 500 errors from Heroku may find entries like this in the logs (heroku logs):

2011-09-22T11:43:49+00:00 heroku[router]: Error H12 (Request timeout) -> GET www.domain.com/controller/action dyno=web.1 queue= wait= service=30000ms status=503 bytes=0

The H12 is a Heroku routing layer-specific problem. It indicates your request took over 30 seconds (why is for another post).

In Heroku's words:

An H12 error happens when our routing layer intercepts a request longer than 30 seconds. The request is terminated and an HTTP 504 (Gateway Timeout) response is returned to the client. Meanwhile, the dyno handling the request will finish processing. The dyno will not be able to handle further requests until processing is complete. If your app is seeing a lot of traffic, additional requests may queue behind the busy dyno, causing further H12 errors. For this reason, we recommend using the 'rack-timeout' plugin - https://github.com/kch/rack-timeout - to limit request time in your app.

0 comments: