Workers may run under different uid/gid and don't have permission
to create log files. After master opens log files and makes them
rw-able when default umask is used, workers will be able to open
them upon receiving USR1.
When the worker exited the tempfile is not available anymore so we can't
get the last update and calculate the dynamic timeout introduced in
d76bab4d716fed3f965fbde4ba1a1bba975f03d1 .
This changes fix it by catching the IO error.
fix#863
This reverts commit b5aab16bf590cacff1825410d9cfaea925de5b24.
Change was broken. If we simply switch there, the error when loading the
config will not be reported correctly. We should find a better way.
I took the suggestion of @asvetlov. This change load first all the body
in RAM in the gaiohttp worker to handle classic WSGI application. This
is a temporary fix, it should be replaced asap by a streaming behaviour.
It does the trick anyway for most application since you're not supposed
to handle large body directly with gunicorn.
fix#803
Here's the reproducer in Python 3.3:
$ gunicorn --paste paste.ini --reload
Then I got the following exception:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/threading.py", line 901, in _bootstrap_inner
self.run()
File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 41, in run
for filename in self.get_files():
File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 29, in get_files
for module in sys.modules.values()
File "/home/berker/hacking/mediagoblin/venv3/lib/python3.3/site-packages/gunicorn/reloader.py", line 28, in <listcomp>
re.sub('py[co]$', 'py', module.__file__)
RuntimeError: dictionary changed size during iteration
The `is_fileobject()` function in utils.py would break when the respones
was a wrapped `HTTPResponse`'s `raw` attribute. This just adds the
`IOError` exception type to the `is_fileobject()` function so that the
response can be streamed normally.
Fixes#805
This will restore graceful shutdown of workers by master.
Also worker_int callback is moved from handle_exit (INT and TERM before switching) to handle_quit(INT and QUIT).