[ZBX-22919] Zabbix proxy still hanging on shutdown Created: 2023 Jun 06  Updated: 2025 Jan 21

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 5.0.35
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Jonybat Assignee: Jurijs Klopovskis
Resolution: Unresolved Votes: 1
Labels: dependencies, reboot, systemd, timeout
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team B
Sprint: Product delivery backlog

 Description   

The issue described in https://support.zabbix.com/browse/ZBX-15602 persists

Debian 11, zabbix-proxy-pgsql_5.0.35

I suppose zabbix-server suffers from the same issue

 

Steps to reproduce:

  1. Stop postgresql.service
  2. Shutdown/reboot host

Result:

Notice how host will hang on stopping zabbix proxy (no limit)

Expected:

Zabbix proxy should not prevent host from shutting down/restarting, within a sensible time period

 

Aside from the mysterious reason to have TimeoutSec=Infinity, there only seem to be an order dependency between zabbix-proxy and postgresql systemd unit files, not a requirement dependency. From my limited understanding of systemd, using After=postgresql.service option will only define the order in which services should be started, but will not make it so that stopping postgresql.service will stop zabbix-proxy.service. This is what should happen, and that would require using one of Wants=, Requires=, PartOf=, ...

https://www.freedesktop.org/software/systemd/man/systemd.unit.html

 

Current unit file

[Unit]
Description=Zabbix Proxy
After=syslog.target
After=network.target
After=postgresql.service

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_proxy.conf"
EnvironmentFile=-/etc/default/zabbix-proxy
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_proxy.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_proxy -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=infinity

[Install]
WantedBy=multi-user.target

 

For those interested, i have added the following for my use case (not responsible for loss of proxy data, bla bla):

[Unit]
PartOf=postgresql.service

[Service]
TimeoutSec=90s

Generated at Wed May 07 09:41:28 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.