fix: log SIGTERM as info level, not warning

SIGTERM is expected during graceful shutdown and reload operations.
Logging it as warning level causes unnecessary noise in error logs.
SIGKILL remains at error level (suggests OOM), other signals at warning.

Closes #3094
This commit is contained in:
Benoit Chesneau 2026-01-23 11:03:27 +01:00
parent 19d07bd4af
commit bbc9bba95e
2 changed files with 6 additions and 3 deletions

View File

@ -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:

View File

@ -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