How do I debug a HTTP 502 error?

Posted by Bialecki on Stack Overflow See other posts from Stack Overflow or by Bialecki
Published on 2010-06-02T23:47:32Z Indexed on 2010/06/02 23:54 UTC
Read the original article Hit count: 390

Filed under:
|
|

I have a Python Tornado server sitting behind a nginx frontend. Every now and then, but not every time, I get a 502 error. I look in the nginx access log and I see this:

127.0.0.1 - - [02/Jun/2010:18:04:02 -0400] "POST /a/question/updates HTTP/1.1" 502 173 "http://localhost/tagged/python" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"

and in the error log:

2010/06/02 18:04:02 [error] 14033#0: *1700 connect() failed (111: Connection refused)
while connecting to upstream, client: 127.0.0.1, server: _,
request: "POST /a/question/updates HTTP/1.1",
upstream: "http://127.0.0.1:8888/a/question/updates", host: "localhost", referrer: "http://localhost/tagged/python"

I don't think any errors show up in the Tornado log. How would you go about debugging this? Is there something I can put in the Tornado or nginx configuration to help debug this?

EDIT: In addition, I get a fair number of 504, gateway timeout errors. Is it possible that the Tornado instance is just busy or something?

© Stack Overflow or respective owner

Related posts about python

Related posts about http