WebFaction
Community site: login faq

I am not very experienced with nginx or Apache, but I'm running Django 1.3 with Python 2.7 and every request to a Django powered page results in a 504 error. I provided some logs which I need help deciphering and some direction towards a solution...

2011/06/12 16:54:17 [info] 727#0: *8279348 client closed prematurely connection, so upstream connection is closed too while sending request to upstream, client: 173.21.197.55, server: coupio.us, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:10236/", host: "coupio.us"
2011/06/12 16:54:17 [info] 728#0: *8279415 client closed prematurely connection, so upstream connection is closed too while sending request to upstream, client: 173.21.197.55, server: coupio.us, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:10236/", host: "www.coupio.us", referrer: "http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBYQFjAA&url=http%3A%2F%2Fwww.coupio.us%2F&rct=j&q=coupio%20us&ei=djX1TcfcIOLk0QGLsM3sDA&usg=AFQjCNF3FiicZK8FcS7hx8NtoaArqtRsAw&sig2=zsxgq4ugfgZXRGWtOZnCng"
2011/06/12 17:16:13 [error] 21751#0: *8286532 connect() failed (111: Connection refused) while connecting to upstream, client: 71.187.211.153, server: coupio.us, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:10236/", host: "coupio.us"
2011/06/12 17:16:13 [error] 21751#0: *8286534 connect() failed (111: Connection refused) while connecting to upstream, client: 71.187.211.153, server: coupio.us, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:10236/favicon.ico", host: "coupio.us", referrer: "http://coupio.us/"
2011/06/12 17:22:40 [error] 21751#0: *8286750 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 71.187.211.153, server: coupio.us, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:10236/", host: "coupio.us"

asked 12 Jun '11, 17:44

michaelgrosner
1112
accept rate: 0%


The 504 error means that your app is taking too long to return a response to the front-end web server. That's the "upstream timed out" message you see in your ~/logs/frontend/error_whatever.log file.

You should look in your Apache's error log for some errors that might point to problems in your app that could cause it to time out. Your Apache error log is located in ~/logs/users/error_nameofyourapp.log.

A somewhat-common cause of timeout errors is calls to external APIs (like Facebook and Twitter) so if your app is doing that and hanging, then there's a good place to start looking for problems.

permanent link

answered 12 Jun '11, 19:37

seanf
12.2k41836
accept rate: 37%

I've disabled all external APIs in use other than the Django calls. I enabled debug logging and in my ~/logs/users/error_**.log I keep on getting

[Mon Jun 13 09:55:49 2011] [error] server reached MaxClients setting, consider raising the MaxClients setting

despite my site gets (nearly) no traffic yet. I've changed it from 1 to 5 to 256, restarted apache every time, yet keep on getting this error. Any more thoughts?

(13 Jun '11, 09:58) michaelgrosner

Despite the log type saying "error", this isn't really an error. It's more of a warning.

Most of our Apache-based apps use the worker MPM. With this type of server, you have to raise ThreadsPerChild, too.

(13 Jun '11, 10:17) David L ♦♦

Still spitting back these errors. Should I provide more information?

(13 Jun '11, 13:25) michaelgrosner

Can you provide a URL where we can reproduce the issue? Thanks!

(13 Jun '11, 22:47) ryans ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×225
×186
×108

question asked: 12 Jun '11, 17:44

question was seen: 13,478 times

last updated: 13 Jun '11, 22:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM