Means that client aborted request before all data could be read back.
In this case, if nginx as front end then nginx saw aborted connection
and in turn closed its connection through to Apache.

Alternatively, if using load balancing and timeouts in nginx for proxy
connections, then nginx may have felt request was talking too long and
closed connection, perhaps trying another back end server.

Graham

2009/10/13 Arthur Debert <deb...@gmail.com>:
>
> Hi There.
>
> I have a django application running nginx as a front end to mod_wsgi.
> The site is responsive and generally stable, but every now and then
> I'll get 502 bad gateway errors.
>
> This shows up on the apache log:
> ==================================
> [Mon Oct 12 11:40:07 2009] [error] [client 127.0.0.1] mod_wsgi
> (pid=12136): Exception occurred processing WSGI script '/home/
> stimuli/.virtualenvs/stimuliwww/apache/django.swgi'.
> [Mon Oct 12 11:40:07 2009] [error] [client 127.0.0.1] IOError: failed
> to write data
> ==================================
>
> The django.swgi looks like this:
> ==================================
> import os, sys
>
> # activate virtualenv
> activate_this = os.path.expanduser("/home/stimuli/.virtualenvs/
> stimuliwww/bin/activate_this.py")
> execfile(activate_this, dict(__file__=activate_this))
>
> # tell django where our settings module is
> sys.path.insert(0,
> os.path.expanduser("/home/stimuli/.virtualenvs/stimuliwww/"))
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> # run django
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> This is a very intermittent error. Strangely, when load testing with
> siege, under heavy load, I the error doesn't happen.
>
> The wsig conf is:
> ==================================
> <VirtualHost *:8080>
>    #Basic setup
>    ServerAdmin at...@stimuli.com.br
>    ServerName www.stimuli.com.br
>    ServerAlias stimuli.com.br
>
>    <Directory /home/stimuli/.virtualenvs/stimuliwww/apache/>
>        Order deny,allow
>        Allow from all
>    </Directory>
>
>    LogLevel warn
>    ErrorLog  /var/log/apache2/stimuli.com.br/apache_error.log
>    CustomLog /var/log/apache2/stimuli.com.br/apache_access.log
> combined
>
>    WSGIDaemonProcess www.stimuli.com.br user=www-data group=www-data
> threads=45
>    WSGIProcessGroup www.stimuli.com.br
>    WSGIScriptAlias / /home/stimuli/.virtualenvs/stimuliwww/apache/
> django.swgi
> </VirtualHost>
> ==================================
>
> Apache servers are configures with:
> ==================================
> <IfModule prefork.c>
> StartServers         7
> MinSpareServers      7
> MaxSpareServers      7
> MaxClients          14
> MaxRequestsPerChild  800
> </IfModule>
> ==================================
>
> The nginx proxy conf is as follows:
> ==================================
> proxy_redirect              off;
> proxy_set_header            Host $host;
> proxy_set_header            X-Real-IP $remote_addr;
> proxy_set_header            X-Forwarded-For
> $proxy_add_x_forwarded_for;
> client_max_body_size        10m;
> client_body_buffer_size     128k;
> proxy_connect_timeout       90;
> proxy_send_timeout          90;
> proxy_read_timeout          90;
> proxy_buffer_size           4k;
> proxy_buffers               32 32k;
> proxy_busy_buffers_size     64k;
> proxy_temp_file_write_size  64k;
> ==================================
>
> Is there anything clearly wrong with my setup? Any ideas on how to
> further debug it?
> Thanks,
> Arthur
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modwsgi@googlegroups.com
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to