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?

Guillaume
  • 21,685
  • 6
  • 63
  • 95
  • 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. – docwhat Mar 23 '12 at 23:23
  • 1
    @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? – Guillaume Mar 24 '12 at 11:15
  • Ah, I found it... It's actually "Events" not "Alerts" ... at least on the heroku interface for logentries. Thanks! – docwhat Mar 27 '12 at 20:43

1 Answers1

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.

docwhat
  • 11,435
  • 6
  • 55
  • 54
  • 1
    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 :) – joshuacronemeyer Jul 28 '12 at 00:18
  • Now, given the recent buzz, you should probably switch to Unicorn. [See here.](https://blog.heroku.com/archives/2013/4/3/routing_and_web_performance_on_heroku_a_faq) – rapcal Apr 03 '13 at 23:42
  • 1
    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. – MegaTux Aug 03 '13 at 02:14
  • Yeah in the last month, its stopped working for me as well. I probably should switch to unicorn or something. – docwhat Aug 05 '13 at 01:42
  • 7
    I'm using Unicorn configured as per Heroku's guidelines and suggested configuration, and I have the same problem. Anyone know of a solution? – elsurudo Aug 20 '13 at 15:36
  • Also using Unicorn and receiving these alerts a few times a week. – Stefan Magnuson Oct 01 '14 at 07:00