mediumIntermediateSymptom-first#sigterm#signal#process#kill#stop

Process ignores SIGTERM — cannot be gracefully stopped

systemctl stop <service> hangs for the full timeout

Likely source:availability

Focused incident mode — strips away everything but this runbook.

Symptoms

  • systemctl stop <service> hangs for the full timeout
  • kill -TERM <PID> has no effect; process keeps running
  • Service restart cycles take too long due to shutdown timeout

Always try SIGTERM before SIGKILL. If the application ignores SIGTERM, that is a code bug to be fixed, not a reason to use SIGKILL routinely.

Evidence to grab

Collect these artifacts before you change anything — they prove (or rule out) each cause.

  • Process signal handling

    cat /proc/<PID>/status | grep Sig
  • Process open file descriptors

    ls /proc/<PID>/fd | wc -l

Diagnostic flow

Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.

Guided decision tree is ready.

Steps with commands, expected output, and pass/fail branches.

Ranked root causes

Evidence checklist

  • SigIgn shows bit 15 (SIGTERM) is set
  • kill -TERM has no visible effect

Confirm before fixing

cat /proc/<PID>/status | grep SigIgn
READ

Check the signal ignore mask

Fix

kill -TERM <PID>; sleep 5; kill -0 <PID> 2>/dev/null && kill -9 <PID>
DESTRUCTIVE

Try TERM first, then escalate to SIGKILL after timeout

Resolution runbook

Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.

1
kill -TERM <PID>
CHANGE

Attempt graceful shutdown first

2
cat /proc/<PID>/status | grep Sig
READ

Check if SIGTERM is being ignored

3
sleep 10 && kill -0 <PID> 2>/dev/null && kill -9 <PID>
DESTRUCTIVE

Escalate to SIGKILL if SIGTERM has no effect

Prevention

  • Ensure all services handle SIGTERM and perform graceful shutdown (close DB connections, drain queues).
  • Set TimeoutStopSec in systemd unit files so systemctl stop does not hang indefinitely.
  • Test graceful shutdown as part of deployment smoke tests.
  • Use docker stop with a timeout for containerized applications.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.