1

I'm getting occasional 502 bad gateway errors with nginx and uwsgi. Inspecting my uwsgi log file I occasionally see

uwsgi_proto_uwsgi_parser(): Error 0 [proto/uwsgi.c line 35]

I did a load test and I received 285 succesfull requests and 4 bad ones. The above line appeared exactly 4 times in that file so its definitely that error that is causing the problem.

I didn't find anything online about that specific error. Anyone have any suggestions?

I don't get this error just under load as it sometimes happens when I'm just testing my app myself making one request at a time.

This is how I'm starting uwsgi

uwsgi-3.3 --socket /tmp/uwsgi.sock --wsgi-file RunOperation.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191 --daemonize /root/uwsgi/log.log --pidfile /root/uwsgi/pidfile.txt --vacuum

And this is the relevant part of my nginx config

uwsgi_pass unix:///tmp/uwsgi.sock;
uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;

Thanks.

1
  • Switched to gunicorn. Now I'm only getting 502 bad gateway errors once for every 5000 requests. I would like it to be 0, is that too much to ask? Is having an error for every 5000 requests normal? gunicorn doesn't log any errors Jul 31, 2014 at 1:13

0

You must log in to answer this question.

Browse other questions tagged .