Rails app hosted on heroku: Error R12 (Exit timeout)
Asked Answered
A

1

16

I have a Rails 3.1.4 app hosted on heroku. I have added the logentries add-on. I didn't touch the default configuration for alerts, and I now receive every few hours an alert: 'Exit timeout':

Exit timeout: Heroku/myappname

2012-03-23 11:01:41.723
168 <40>1 2012-03-23T11:01:41+00:00 d. heroku web.1 - - Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM

You are receiving this email because your Logentries alarm "Exit timeout"
has been triggered.

In context:
2012-03-23 11:01:28.878 95 <40>1 2012-03-23T11:01:28+00:00 d. heroku web.1 - - Idling
2012-03-23 11:01:31.740 118 <40>1 2012-03-23T11:01:31+00:00 d. heroku web.1 - - Stopping process with SIGTERM
2012-03-23 11:01:41.723 168 <40>1 2012-03-23T11:01:41+00:00 d. heroku web.1 - - Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM

The logs nor this email alert do not give me anything useful to start looking for this issue.

I have a very low traffic (application still in private beta). I suspect it's heroku shutting down the application, and my application does not respond as expected to the SIGTERM signal.

I do not have anything fancy in the application (such as a rake task launched with Heroku Scheduler).
The only thing slightly out of the ordinary is the use of the gem apn_on_rails, which open a connection to Apple's APN servers.

Do you have any idea what is causing this? Should I just ignore this and turn the alert off?

Anticathexis answered 23/3, 2012 at 11:59 Comment(3)
On the one hand, it's normal -- Heroku kills and starts rails based on need. However, I haven't figured out how to stop getting emails about this.Ogilvie
@TheDoctorWhat: To stop receiving email is easy: go to the log entries settings of your app, tab Alerts, and delete the alert for Exit Timeout. Heroku kills the app, I'm ok with that. But it seems to expect the process to shutdown within 10 seconds of receiving a SIGTERM signal, which it does't. Is this normal? Is there anything to change?Anticathexis
Ah, I found it... It's actually "Events" not "Alerts" ... at least on the heroku interface for logentries. Thanks!Ogilvie
O
6

If you're using webrick to run your application on Heroku, you should switch to using 'thin': See https://devcenter.heroku.com/articles/rails3#webserver

This removed all occurrences of the R12 error from my logs.

Ogilvie answered 27/3, 2012 at 20:45 Comment(6)
Guillaume, you should accept this answer if it worked for you. I had the same problem and The Doctor What's solution was just what the Doctor ordered :)Indignation
Now, given the recent buzz, you should probably switch to Unicorn. See here.Christianachristiane
I'm using Thin server and receiving several of this alerts, so it's not a solution for me. I'll switch to Unicorn shortly.Roue
Yeah in the last month, its stopped working for me as well. I probably should switch to unicorn or something.Ogilvie
I'm using Unicorn configured as per Heroku's guidelines and suggested configuration, and I have the same problem. Anyone know of a solution?Gunner
Also using Unicorn and receiving these alerts a few times a week.Evelineevelinn

© 2022 - 2024 — McMap. All rights reserved.