Manually including the traceback in the log msg causes some issues when
interacting with log formats, and in one case was causing the traceback
to be printed twice.
Add a method to check if config requirements are OK for a specific worker by
adding the `check_config` instance method. This method takes 2 arguments: the
config instance followed by the logger instance to log.
This method is right now used in the thread worker to display a warning in
the case it can't handle keep alive connections. This change is related to #979.
there is no need to send more than once the signal to the workers when
exiting. With this patch we are sending once the QUIT/TERM signal and then
wait until the graceful timeout or until there are workers alive.
fix#655
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 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).
Move setting of env vars from Arbiter.start to Arbiter.setup so that they are available during application start up when 'preload_app' is used.
Closes#735
Move setting of env vars from Arbiter.start to Arbiter.setup so that they are available during application start up when 'preload_app' is used.
Closes#735
Commit 81241907ffcf94517ffa14b8427205906b61b540 changed the signal
handling by switching the roles of `TERM` and `QUIT` for the arbiter
so that `TERM` is graceful and `QUIT` is not.
At the time, workers performed graceful shutdown on `QUIT` and quick
shutdown on `TERM` and `INT`. This behavior was also changed so that
`QUIT` (and `INT`) cause a quick shutdown and `TERM` is graceful.
However, the documentation incorrectly reversed the roles of the worker
signals and the arbiter was not updated to use the correct signals.
This commit fixes the documentation and the arbiter signals.
I can't imagine this wasn't what was intended here. Might be a merge
artifact but I can't trace it.
Thanks to Antti Kaihola (@akaihola) for spotting this.
Close#733
This commit tries to minimize the chance of sending a kill signal
to a process that is not a gunicorn worker by reaping children
as soon as the SIGCHLD is received.
Close#371
"Limits the number of worker processes to 1" hasn't been true since
06a4dc6 (fix one error in gunicorn_paster, global conf was ignored,
2010-06-22), although it was true when the line was added in 3c7d532
(Large refactor of the documentation and website, 2010-05-22).
"changes some error handling that's sent to clients" hasn't been true
since feb86d3 (don't display the traceback in the HTTP response,
2013-09-27).
The only remaining actions that --debug had were disabling --preload
and hiding debug-level config logging. The former seems useless (just
disable --preload directly) and the latter at doesn't seem useful
enough for a new setting (just turn down --log-level). With this
commit, --preload always works and you always get debug-level config
logging.
I left a stub Debug entry in gunicorn.config, which we can leave in
place while folks convert any gunicorn scripts and configurations to
drop --debug. When the time comes, we can just remove that entry. I
also the boolean-config tests to use --preload, since that will still
be around after we remove the dummy Debug entry.
Fixes#700.
`cfg.worker_class` is a property, which calls the classmethod `setup` of
the worker class when accessed. Gevent worker relies on this mechanism
to call `gevent.monkey.patch_all()`.
However, `num_workers` is a hooked property, when it is set, gunicorn
will call hook defined by user. If the hooked code relies on
gevent's monkey patch, it will fail because the monkey patch has not
been applied yet.
This commit makes sure that `worker_class` property getter invokes
before `num_workers` setter to resolve this problem.
SIGWINCH could happen often in the console when the terminal is resized.
Since the error is harmless just display it when the logging level is
debug.
fix#449
This command line argunment allows someone to pass an environement variable to
gunicorn:
$ gunicorn --env FOO=1 test:app
With the command line above the application will be able to use the FOO
environment vatriable.