diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 8e27dca4..da294283 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -551,8 +551,11 @@ class Arbiter: if sig == signal.SIGKILL: msg += " Perhaps out of memory?" self.log.error(msg) + elif sig == signal.SIGTERM: + # SIGTERM is expected during graceful shutdown + self.log.info(msg) else: - # SIGTERM/SIGQUIT are expected during shutdown + # Other signals are unexpected self.log.warning(msg) if exitcode is not None and exitcode != 0: diff --git a/tests/test_arbiter.py b/tests/test_arbiter.py index e9d03e19..ff855b46 100644 --- a/tests/test_arbiter.py +++ b/tests/test_arbiter.py @@ -407,8 +407,8 @@ class TestReapWorkers: mock_worker = mock.Mock() arbiter.WORKERS = {42: mock_worker} - # SIGTERM should be logged as warning (not error) - with mock.patch.object(arbiter.log, 'warning') as mock_log: + # SIGTERM should be logged as info (expected during graceful shutdown) + with mock.patch.object(arbiter.log, 'info') as mock_log: arbiter.reap_workers() # Should log the signal