In WSGI you can do: def app(environ, start_response): start_response('200 OK', [('Content-type', 'text/html')]) f = open('test.html', 'rb') return environ['wsgi.file_wrapper'](file, 4096) This is so that the server can more efficiently handle serving files. Unfortunately this seems to be broken, at least on somewhat larger files. I get this exception in the logs: Traceback (most recent call last): File "/var/vcap.local/dea/apps/seeitsaveit-0-ebec5b7efd0703e08deb40a66ea6b6ce/python/lib/python2.6/site-packages/gunicorn/workers/sync.py", line 108, in handle_request resp.write_file(respiter) File "/var/vcap.local/dea/apps/seeitsaveit-0-ebec5b7efd0703e08deb40a66ea6b6ce/python/lib/python2.6/site-packages/gunicorn/http/wsgi.py", line 333, in write_file self.sendfile_all(fileno, self.sock.fileno(), fo_offset, nbytes) File "/var/vcap.local/dea/apps/seeitsaveit-0-ebec5b7efd0703e08deb40a66ea6b6ce/python/lib/python2.6/site-packages/gunicorn/http/wsgi.py", line 310, in sendfile_all sent += sendfile(sockno, fileno, offset+sent, nbytes-sent) File "/var/vcap.local/dea/apps/seeitsaveit-0-ebec5b7efd0703e08deb40a66ea6b6ce/python/lib/python2.6/site-packages/gunicorn/http/_sendfile.py", line 66, in sendfile raise OSError(e, os.strerror(e)) OSError: [Errno 11] Resource temporarily unavailable I can fix the problem by doing "del environ['wsgi.file_wrapper']" in my application before trying to serve any static files. The exception happens in the middle of the page; that is, some of the content is served properly.
Could this be an issue with sendfile() and python2.6 ? Or something similar ?
A google gave me this possibly related issue: https://github.com/benoitc/gunicorn/issues/428 I'm not actually sure what that all means though.
You need to log in before you can comment on or make changes to this bug.