Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

503 Service Unavailable but heroku logs show 200

I'm making an expensive call to my Heroku Rails server. After 13-15 seconds the console in my browser reports a Service Unavailable 503 error. However when I check my heroku logs, it reports:

Completed 200 OK in 45592ms (Views: 220.3ms | ActiveRecord: 33457.5ms)

Other times the heroku logs report a memory exceeded quota. Here is an example of that below.

2015-06-11T15:17:20.238285+00:00 app[web.1]: Completed 200 OK in 81881ms (Views: 201.6ms | ActiveRecord: 18021.2ms)
2015-06-11T15:17:33.482930+00:00 heroku[web.1]: Process running mem=841M(164.4%)
2015-06-11T15:17:33.482930+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2015-06-11T15:17:53.147570+00:00 heroku[web.1]: Process running mem=841M(164.4%)
2015-06-11T15:17:53.147679+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2015-06-11T15:17:59.751540+00:00 app[web.1]: E, [2015-06-11T15:17:59.695813 #3] ERROR -- : worker=2 PID:13 timeout (121s > 120s), killing
2015-06-11T15:17:59.916750+00:00 app[web.1]: E, [2015-06-11T15:17:59.906435 #3] ERROR -- : reaped #<Process::Status: pid 13 SIGKILL (signal 9)> worker=2
2015-06-11T15:18:02.487428+00:00 app[web.1]: I, [2015-06-11T15:18:02.427293 #16]  INFO -- : worker=2 ready

Why is it reporting a Completed 200 when the console is reporting a 503?

like image 694
thank_you Avatar asked Jun 11 '15 14:06

thank_you


People also ask

What is 503 error Heroku?

Whenever your app experiences an error, Heroku will return a standard error page with the HTTP status code 503. To help you debug the underlying error, however, the platform will also add custom error information to your logs.

How do I view heroku logs?

You can view logs with the Heroku CLI, the dashboard, your logging add-on, or in your log drain. You can't view logs for apps in Shield spaces with Private Space Logging enabled. Retrieve logs from your log drain instead.


2 Answers

there are 2 different things here:

  • your app
  • the heroku load balancer

In this case the load balancer see that the request is taking too long and sends you the 503. In the back the service processes the request and returns completes with a 200.

See:

https://devcenter.heroku.com/articles/limits

https://devcenter.heroku.com/articles/request-timeout

like image 200
Mircea Avatar answered Sep 25 '22 06:09

Mircea


Heroku does not gives us much information for error-code = H10. Simple put, something is going wrong with your application code / configuration. To see what's going wrong, run heroku run rails console and you will be able to see error details which will be help you in resolving the error. No need to use logs. heroku run rails console is a big help

like image 29
Mani Avatar answered Sep 23 '22 06:09

Mani