Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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 '11 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. –  Martin Fjordvald Jul 15 '11 at 7:15

1 Answer 1

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.

share|improve this answer
    
Odd that it SEG faults on exception, thanks for the answer. –  David Apr 25 '13 at 0:26
    
It doesn't segfault. It just raises an unhandled exception. –  Antonis Christofides Apr 25 '13 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 '13 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. –  Antonis Christofides Apr 26 '13 at 11:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.