Bug#813487: pgbouncer: Upgrading pgbouncer drops connections when run with systemd
Re: Peter Eisentraut 2020-01-11 > It might be possible to do this if we have systemd organize the file > descriptor passing (using socket activation and all that). It's something > I've been meaning to look into, but it would be a development effort, not > just a packaging change. That sounds promising; all that would be left to do would be to keep the old instance running while there are still connections to it. > Another option might be to use the SO_REUSEPORT socket option and start a > new pgbouncer instance concurrently with the old one. Then you can shut > down the old one once the new one is up and taking on connections. I don't > know whether that's in scope for packaging, either, though. That would still need systemd allowing to start two instances in parallel. I think implementing something along these lines is a prerequisite for the first solution. Christoph
Bug#813487: pgbouncer: Upgrading pgbouncer drops connections when run with systemd
On 2019-11-28 18:02, Christoph Berg wrote: Not sure if there's a way around that, certainly not with TLS connections (but that doesn't work without systemd either). Possibly moving the connections to a helper process first, and then exec()ing to the new version, and moving the connections back to the original PID would work. It might be possible to do this if we have systemd organize the file descriptor passing (using socket activation and all that). It's something I've been meaning to look into, but it would be a development effort, not just a packaging change. Another option might be to use the SO_REUSEPORT socket option and start a new pgbouncer instance concurrently with the old one. Then you can shut down the old one once the new one is up and taking on connections. I don't know whether that's in scope for packaging, either, though.
Bug#813487: pgbouncer: Upgrading pgbouncer drops connections when run with systemd
Control: tags -1 upstream Re: Chris Butler 2016-02-02 <20160202131415.28076.48745.report...@taskrunner.staging.trac.jobs> > In the good old sysvinit days, an upgrade to pgbouncer could be done > seamlessly > because the init script used the -R flag to tell pgbouncer to take over from > the > existing daemon. However, it seems like this doesn't happen when using > systemd. > > Is there any way to bring back zero connection loss upgrades under systemd? Hi, I always meant to bring back this behavior with the systemd service file, but after chatting about this with one of the upstream authors, Peter Eisentraut, at the last PGconf.EU, we figured that it's unfortunately unfixable. The problem is that pgbouncer spawns a new process, transfers the open file descriptors, and exits. Systemd doesn't like that the original process goes away. Not sure if there's a way around that, certainly not with TLS connections (but that doesn't work without systemd either). Possibly moving the connections to a helper process first, and then exec()ing to the new version, and moving the connections back to the original PID would work. Peter? Christoph
Bug#813487: pgbouncer: Upgrading pgbouncer drops connections when run with systemd
Package: pgbouncer Version: 1.7-1.pgdg80+1 Severity: normal Hi, In the good old sysvinit days, an upgrade to pgbouncer could be done seamlessly because the init script used the -R flag to tell pgbouncer to take over from the existing daemon. However, it seems like this doesn't happen when using systemd. Is there any way to bring back zero connection loss upgrades under systemd? -- System Information: Debian Release: 8.3 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-042stab108.2 (SMP w/40 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages pgbouncer depends on: ii libc6 2.19-18+deb8u2 ii libevent-2.0-5 2.0.21-stable-2 ii libssl1.0.01.0.1k-3+deb8u2 ii lsb-base 4.1+Debian13+nmu1 ii postgresql-common 172.pgdg80+1 pgbouncer recommends no packages. Versions of packages pgbouncer suggests: ii python 2.7.9-1 pn python-psycopg2 -- Configuration Files: /etc/default/pgbouncer changed [not included] /etc/pgbouncer/pgbouncer.ini [Errno 13] Permission denied: u'/etc/pgbouncer/pgbouncer.ini' /etc/pgbouncer/userlist.txt [Errno 13] Permission denied: u'/etc/pgbouncer/userlist.txt' -- no debconf information