The access log is updated by the Apache child worker process that for daemon mode is proxying the connection to the actual process running your application. In this case where the client drops the connection before a complete response could be sent back by the child worker process, Apache is overriding the original status code that may have come from the WSGI application, to indicate a failure occurred. I will need to go back and look at the Apache code but I am not sure I can change the behaviour of how Apache works for this. As far as Apache is conce
Graham > On 16 Jan 2018, at 12:08 pm, Jesus Cea <[email protected]> wrote: > > Using Apache 2.4.29, mod_wsgi 4.5.24 and Python 3.6.4. > > I serve big files using WSGI and an iterator. When the client closes the > connection BEFORE the file is completed, an error 500 is logged in > Apache, without any indication of the issue or how to solve it. > > I have a minimal testcase: > > 1. Apache configuration: Inside a virtualhost I do this: > > """ > WSGIDaemonProcess test threads=16 display-name=%{GROUP} > python-path=/home/buffy/ home=/home/buffy/ stack-size=524288 > WSGIApplicationGroup %{GLOBAL} > WSGIProcessGroup test > WSGIScriptAlias /test /home/buffy/z.py > <Location /test/> > require all granted > </Location> > """ > > 2. The WSGI application "/home/buffy/z.py" is quite trivial: > > """ > class app: > def __init__(self, environ, start_response): > start_response('200 OK', > [('content-type', 'application/octet-stream')]) > > def __iter__(self): > while True: > yield b'W'*4096 > > def application(environ, start_response) : > return app(environ, start_response) > """ > > Any request inside "/test/" with wget or similar will generate an > infinitely long file. Just do a random request with "wget", let it go > for a couple of seconds (the file size if unbounded, beware) and abort > "wget" with control+c. > > What I get: An error 500 in my Apache virtualhost access log. Nothing in > the error log. > > What I would like to get: a 200 in my Apache virtualhost access log. > > What am I doing wrong?. A "def close(self): pass" doesn't change > anything. Suggestions?. > > -- > Jesús Cea Avión _/_/ _/_/_/ _/_/_/ > [email protected] - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ > Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ > jabber / xmpp:[email protected] _/_/ _/_/ _/_/ _/_/ _/_/ > "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ > "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ > "El amor es poner tu felicidad en la felicidad de otro" - Leibniz > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
