5

I used this guide to set it up and it was working to server my django app for a while, but after adding a new django module, without touching any of the nginx or uwsgi configs, now the server leads to 502 502 Bad Gateway error. The nginx error.log says:

*1 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: blabla.com, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:4000", host: "x.x.x.x"

I appreciate your hints to resolve this.

2
  • 1
    I was wondering if you ever solved this problem. The same thing is happening to me now and its really frustrating.
    – thebeagle
    Jul 15, 2011 at 6:36
  • 2
    @TheBeagle This happens due to the upstream script crashing before it can properly close the connection. Most likely it's a bad module that causes a segmentation fault or some form of crash. Jul 15, 2011 at 7:15

1 Answer 1

3

This error usually indicates that your Django application has crashed (raised an unhandled exception). You should be able to get more information from the uwsgi logs at /var/log/uwsgi.

4
  • Odd that it SEG faults on exception, thanks for the answer.
    – David
    Apr 25, 2013 at 0:26
  • It doesn't segfault. It just raises an unhandled exception. Apr 25, 2013 at 8:49
  • That's what I meant, the logs say its a seg fault but the reality is that it's an unhandled exception.
    – David
    Apr 25, 2013 at 15:02
  • Thanks for this clarification, I didn't remember that. I'm quite unsatisfied with uwsgi (too many features, very underdocumented) and I think I'll migrate to gunicorn or so one day. Apr 26, 2013 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .