[ZBX-19709] kill(1) in systemd service files produces confusing error messages in log if the service failed to start Created: 2021 Jul 15 Updated: 2024 Apr 10 Resolved: 2021 Oct 17 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Packages (C) |
Affects Version/s: | 5.4.2 |
Fix Version/s: | 5.4.6rc1, 6.0.0alpha4, 6.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | WHR | Assignee: | Jurijs Klopovskis |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Debian GNU/Linux version 9 (Stretch), with systemd(1) as init system. |
Team: | |
Sprint: | Sprint 78 (Jul 2021), Sprint 79 (Aug 2021), Sprint 80 (Sep 2021) |
Story Points: | 0.5 |
Description |
Currently the systemd service configuration files installed by Zabbix Debian packages contain the following line: ExecStop=/bin/kill -SIGTERM $MAINPID It works fine in most cases; but if the specified service has failed to start, for example, failed to bind(2) to its listing port, systemd(1) will invoke the ExecStop command line with $MAINPID expanded to empty, before trying to restart the service; the caused kill(1) to produce a long usage message in log, becasue no PID is specified; take service zabbix-agent for example, the log would be like: Jul 15 12:56:23 x systemd[1]: Starting Zabbix Agent... Jul 15 12:56:23 x systemd[1]: zabbix-agent.service: Supervising process 69594 which is not our child. We'll most likely not notice when it exits. Jul 15 12:56:23 x systemd[1]: Started Zabbix Agent. Jul 15 12:56:23 x systemd[1]: zabbix-agent.service: Main process exited, code=exited, status=1/FAILURE Jul 15 12:56:23 x kill[69598]: Usage: Jul 15 12:56:23 x kill[69598]: kill [options] <pid> [...] Jul 15 12:56:23 x kill[69598]: Options: Jul 15 12:56:23 x kill[69598]: <pid> [...] send signal to every <pid> listed Jul 15 12:56:23 x kill[69598]: -<signal>, -s, --signal <signal> Jul 15 12:56:23 x kill[69598]: specify the <signal> to be sent Jul 15 12:56:23 x kill[69598]: -l, --list=[<signal>] list all signal names, or convert one to a name Jul 15 12:56:23 x kill[69598]: -L, --table list all signal names in a nice table Jul 15 12:56:23 x kill[69598]: -h, --help display this help and exit Jul 15 12:56:23 x kill[69598]: -V, --version output version information and exit Jul 15 12:56:23 x kill[69598]: For more details see kill(1). Jul 15 12:56:23 x systemd[1]: zabbix-agent.service: Control process exited, code=exited status=1 Jul 15 12:56:23 x systemd[1]: zabbix-agent.service: Unit entered failed state. Jul 15 12:56:23 x systemd[1]: zabbix-agent.service: Failed with result 'exit-code'. These log messages will repeating every time the service process failed. ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID" In addition, the kill(1) command usage has changed silently for POSIX compliance; specifically, according to this page: Values of signal_name shall be recognized in a case-independent fashion, without the SIG prefix. |
Comments |
Comment by Jurijs Klopovskis [ 2021 Jul 21 ] |
Moved to ZBX |
Comment by Jurijs Klopovskis [ 2021 Jul 22 ] |
Fixed in pre 5.4.4 for debian-based distros. |