[ZBX-19870] Add "After=pgbouncer.service" in systemd files for Zabbix Server and Proxy Created: 2021 Aug 27  Updated: 2022 Apr 04

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: Packages (C), Proxy (P), Server (S)
Affects Version/s: 5.4.3
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Marcel Renner Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 5.3.18-59.19-default #1 SMP Tue Aug 3 14:11:23 UTC 2021 (055c4fd) x86_64 x86_64 x86_64 GNU/Linux
NAME="SLES"
VERSION="15-SP3"
VERSION_ID="15.3"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP3"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp3"


Attachments: Text File zabbix_proxy.log-20210829.txt    
Issue Links:
Duplicate
duplicates ZBX-15602 SystemD "TimeoutSec=infinity" is bad ... Closed

 Description   

Steps to reproduce:

  1. Requires a Zabbix Server or Proxy with local PostgreSQL and PgBouncer instance.
  2. Reboot or shut down the system.

Result:
PgBouncer is terminated before Zabbix Server or Proxy is shut down and the complete process is hanging infinitely.

 

A Stop Job is Running for Zabbix Server

 

A Stop Job is Running for Zabbix Proxy

Expected:
PgBouncer should also be considered and terminated after the Zabbix Server or Proxy has been shut down. If something speaks against it, perhaps a note in the documentation with the workaround would also be sufficient.

 

Workaround:

Add an override for Zabbix server or proxy.

 

systemctl edit zabbix-server.service
systemctl edit zabbix-proxy.service

Add following configuration.

 

 

[Unit]
After=pgbouncer.service

Reload systemd.

systemctl daemon-reload

 

 

 



 Comments   
Comment by Aleksandrs Petrovs-Gavrilovs [ 2021 Aug 30 ]

Hello,

Thank you for your request, would it be possible to attach zabbix server logs, of course with sensitive data omitted?
Does Zabbix eventually stops or is trying to make a connection to the DB indefinitely?

Best Regards,
Aleksandrs

Comment by Marcel Renner [ 2021 Aug 30 ]

Hi Aleksandrs,

Yes, so we actually use PgBouncer everywhere to be able to use the advantages of transaction pooling. Due to a shutdown and missing service dependency, however, PgBouncer is terminated beforehand. The Zabbix Server/Proxy Service does not crash, but tries to establish a connection again. On a proxy, it looks like this.

zabbix_proxy.log-20210829.txt

It's actually not a direct error in Zabbix, in my opinion. It's just that since PostgreSQL doesn't really do pooling and you have to fall back on 3rd party applications, it would be nice if this constellation was also taken into account. A note in the documentation for this override workaround would perhaps also be more than sufficient for other users.

Best regards,

Marcel

Comment by Aleksandrs Petrovs-Gavrilovs [ 2021 Aug 31 ]

Thank you for the update, I see similar issue was addressed previously with the approach you proposed and service files were updated (ZBX-15602)
Missing the them in 5.4 seems like a regression, so I will be confirming the case so we can process it further.

Best Regards,
Aleksandrs

Comment by Renato Custodio Borges [ 2022 Apr 04 ]

Boa tarde
tive este mesmo problema e efetuei a alteração no pgbouncer do pool_mode
de: pool_mode = session
para: pool_mode = transaction

no meu caso resolveu meu problema, mais ainda não sei a performance corretamente.

Generated at Thu May 08 07:59:01 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.