Skip to content

fix: let influxdb, grafana and modbus-serial get SIGTERM (#1680) - #1681

Merged
groupsky merged 1 commit into
masterfrom
fix/sigterm-1680
Oct 11, 2026
Merged

groupsky merged 1 commit into
masterfrom
fix/sigterm-1680

Conversation

@groupsky

Copy link
Copy Markdown
Owner

Fixes #1680.

docker stop sends SIGTERM to PID 1 only. These services never got it, so every stop (deploy or UPS shutdown) waited out the grace period and then SIGKILLed them.

Changes

  • influxdb, grafana secure-entrypoint.sh: exec the upstream entrypoint. The upstream /entrypoint.sh (influxdb) and /run.sh (grafana) already end with exec, so influxd and grafana server become PID 1. (mqtt-influx already used exec.)
  • modbus-serial: exit on SIGTERM. Node as PID 1 ignores a signal it has no handler for. The raw NDJSON file is written with writeSync, so it loses nothing. Points still in the InfluxDB client batch (up to 60 s) are dropped, same as with the kill today; flushing them on stop would be a separate change.
  • influxdb: stop_grace_period: 40s. influxd gives itself 30 s to stop cleanly; the compose default of 10 s could still cut it.

Proof after deploy

  • docker top shows influxd / grafana / node as PID 1.
  • A stop logs a clean shutdown and dockerd logs no "using the force" line.

docker stop sends SIGTERM to PID 1 only. In influxdb and grafana PID 1 was
the secure-entrypoint.sh shell, which ran the real entrypoint without exec,
so influxd and grafana never got the signal. In modbus-serial PID 1 is node
with no handler, and PID 1 ignores a signal it does not handle. Each stop
waited out the grace period and then SIGKILLed them.

- secure-entrypoint.sh (influxdb, grafana): exec the upstream entrypoint,
  which itself execs the server, so the server becomes PID 1.
- modbus-serial: exit on SIGTERM.
- influxdb: stop_grace_period 40s, since influxd allows itself 30 s to
  stop cleanly.
@groupsky
groupsky merged commit 5c5b790 into master Oct 11, 2026
38 checks passed
@groupsky
groupsky deleted the fix/sigterm-1680 branch October 11, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

influxdb, grafana and modbus-serial never get SIGTERM, so every stop (deploy or UPS shutdown) SIGKILLs them

1 participant