pg.ddx.io pgbouncer/pgbouncer GitHub issues and pull requests
help / color / mirror / Atom feedFrom: twoinke (@twoinke) <noreply+twoinke@github.com>
To: pgbouncer/pgbouncer <noreply+pgbouncer-pgbouncer@github.com>
Subject: [pgbouncer/pgbouncer] issue #1697: Sporadic segfault on SIGHUP
Date: Wed, 04 Nov 2026 13:42:49 +0000
Message-ID: <gh-pgbouncer-pgbouncer-1697@github.com> (raw)
### Description
We use logrotate to rotate our pgbouncer logs and reload PGbouncer using SIGHUP.
At some occasions, PGbouncer crashes with a segfault after receiving SIGHUP and reloading.
We are observing this behaviour on multiple nodes. On one node, logrotate has been moved to another time, which made the segfaults also occur on that time, so we know this is related.
We suspect this to be a possible bug in the reload handling in pgbouncer.
#### Expectation
PGbouncer handles SIGHUP and continues without crash
#### Actual behaviour
Sometimes, pgbouncer segfaults when reloading on SIGHUP
#### Log-Entry:
2026-11-01 00:15:05.888 CET [584915] LOG got SIGHUP, re-reading config
2026-11-01 00:15:07.061 CET [3217213] LOG stale pidfile, removing
2026-11-01 00:15:07.061 CET [3217213] LOG kernel file descriptor limit: 65536 (hard: 65536); max_client_conn: 10000, max expected fd use: 252012
2026-11-01 00:15:07.064 CET [3217213] LOG listening on 0.0.0.0:5432
2026-11-01 00:15:07.067 CET [3217213] WARNING cannot listen on [::]:5432: socket(): Address family not supported by protocol
2026-11-01 00:15:07.067 CET [3217213] LOG listening on unix:/run/postgresql/.s.PGSQL.5432
2026-11-01 00:15:07.067 CET [3217213] LOG process up: PgBouncer 1.26.1, libevent 2.1.12-stable (epoll), adns: c-ares 1.27.0, tls: OpenSSL 3.0.13 30 Jan 2024
#### journalctl
Nov 01 00:15:06 hostname.redacted.tld systemd[1]: pgbouncer.service: Main process exited, code=dumped, status=11/SEGV
Nov 01 00:15:06 hostname.redacted.tld systemd[1]: pgbouncer.service: Failed with result 'core-dump'.
#### gdb backtrace
`
Core was generated by `/usr/sbin/pgbouncer -q /etc/pgbouncer/pgbouncer.ini'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
warning: 76 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory
[Current thread is 1 (Thread 0x7b4f51d0dec0 (LWP 584915))]
(gdb) bt
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1 0x00007b4f527448e3 in __GI___inet_pton (af=af@entry=2, src=src@entry=0x0, dst=dst@entry=0x7fff3b81e610) at ./resolv/inet_pton.c:69
#2 0x00005826b4945a08 in tls_check_subject_altname (name=0x0, cert=0x5826cb96f8f0, ctx=0x5826c99b7ca0) at lib/usual/tls/tls_verify.c:96
#3 tls_check_name (ctx=ctx@entry=0x5826c99b7ca0, cert=cert@entry=0x5826cb96f8f0, name=0x0) at lib/usual/tls/tls_verify.c:248
#4 0x00005826b4946184 in tls_handshake_client (ctx=0x5826c99b7ca0) at lib/usual/tls/tls_client.c:267
#5 tls_handshake (ctx=0x5826c99b7ca0) at lib/usual/tls/tls.c:650
#6 0x00005826b4931639 in handle_tls_handshake (sbuf=sbuf@entry=0x7b4f4fe86178) at src/sbuf.c:1400
#7 0x00005826b493178e in sbuf_tls_handshake_cb (fd=<optimized out>, flags=<optimized out>, _sbuf=0x7b4f4fe86178) at src/sbuf.c:1420
#8 0x00007b4f52ff6a30 in ?? () from /lib/x86_64-linux-gnu/libevent-2.1.so.7
#9 0x00007b4f52ff846f in event_base_loop () from /lib/x86_64-linux-gnu/libevent-2.1.so.7
#10 0x00005826b492f63c in main_loop_once () at src/main.c:874
#11 0x00005826b49139c5 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:1106
(gdb) bt full
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
No locals.
#1 0x00007b4f527448e3 in __GI___inet_pton (af=af@entry=2, src=src@entry=0x0, dst=dst@entry=0x7fff3b81e610) at ./resolv/inet_pton.c:69
No locals.
#2 0x00005826b4945a08 in tls_check_subject_altname (name=0x0, cert=0x5826cb96f8f0, ctx=0x5826c99b7ca0) at lib/usual/tls/tls_verify.c:96
altname_stack = 0x5826cc677c60
type = <optimized out>
count = <optimized out>
i = <optimized out>
rv = -1
addrbuf = {ip4 = {s_addr = 4294967295}, ip6 = {__in6_u = {__u6_addr8 = "\377\377\377\377\377\377\377\377\000\000\000\000\000\000\000", __u6_addr16 = {65535, 65535, 65535, 65535, 0, 0, 0, 0}, __u6_addr32 = {4294967295, 4294967295, 0, 0}}}}
addrlen = <optimized out>
altname_stack = <optimized out>
addrbuf = <optimized out>
addrlen = <optimized out>
type = <optimized out>
count = <optimized out>
i = <optimized out>
rv = <optimized out>
altname = <optimized out>
data = <optimized out>
format = <optimized out>
len = <optimized out>
data = <optimized out>
datalen = <optimized out>
#3 tls_check_name (ctx=ctx@entry=0x5826c99b7ca0, cert=cert@entry=0x5826cb96f8f0, name=0x0) at lib/usual/tls/tls_verify.c:248
rv = <optimized out>
#4 0x00005826b4946184 in tls_handshake_client (ctx=0x5826c99b7ca0) at lib/usual/tls/tls_client.c:267
cert = 0x5826cb96f8f0
ssl_ret = <optimized out>
rv = -1
cert = <optimized out>
ssl_ret = <optimized out>
rv = <optimized out>
err = <optimized out>
#5 tls_handshake (ctx=0x5826c99b7ca0) at lib/usual/tls/tls.c:650
rv = -1
#6 0x00005826b4931639 in handle_tls_handshake (sbuf=sbuf@entry=0x7b4f4fe86178) at src/sbuf.c:1400
err = <optimized out>
#7 0x00005826b493178e in sbuf_tls_handshake_cb (fd=<optimized out>, flags=<optimized out>, _sbuf=0x7b4f4fe86178) at src/sbuf.c:1420
sbuf = 0x7b4f4fe86178
#8 0x00007b4f52ff6a30 in ?? () from /lib/x86_64-linux-gnu/libevent-2.1.so.7
No symbol table info available.
#9 0x00007b4f52ff846f in event_base_loop () from /lib/x86_64-linux-gnu/libevent-2.1.so.7
No symbol table info available.
#10 0x00005826b492f63c in main_loop_once () at src/main.c:874
err = <optimized out>
#11 0x00005826b49139c5 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:1106
c = <optimized out>
arg_username = <optimized out>
long_idx = 0
long_options = {{name = 0x5826b494b501 "quiet", has_arg = 0, flag = 0x0, val = 113}, {name = 0x5826b494a6a3 "verbose", has_arg = 0, flag = 0x0, val = 118}, {name = 0x5826b494a701 "help", has_arg = 0, flag = 0x0, val = 104}, {
name = 0x5826b494a5d2 "daemon", has_arg = 0, flag = 0x0, val = 100}, {name = 0x5826b494ae9e "version", has_arg = 0, flag = 0x0, val = 86}, {name = 0x5826b4949d72 "user", has_arg = 1, flag = 0x0, val = 117}, {name = 0x0, has_arg = 0,
flag = 0x0, val = 0}}
`
### Versions
#### PGbouncer
PgBouncer 1.26.1
libevent 2.1.12-stable
adns: c-ares 1.27.0
tls: OpenSSL 3.0.13 30 Jan 2024
systemd: yes
Installed from pgdg repos.
(segfaults occured with earlier versions, too)
#### Operating System
Ubuntu 24.04.4 LTS
#### PostgreSQL
PostgreSQL 16.15. PGDG
### Config
#### pgbouncer.ini
[databases]
%include /etc/pgbouncer/ini/pg12.ini
%include /etc/pgbouncer/ini/pg14.ini
%include /etc/pgbouncer/ini/pg16.ini
%include /etc/pgbouncer/ini/pg18.ini
%include /etc/pgbouncer/ini/pg20.ini
%include /etc/pgbouncer/ini/pg22.ini
%include /etc/pgbouncer/ini/pg24.ini
%include /etc/pgbouncer/ini/pg26.ini
%include /etc/pgbouncer/ini/pg28.ini
[pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = *
listen_port = 5432
unix_socket_dir = /run/postgresql
unix_socket_mode = 0777
auth_type = hba
auth_hba_file = /etc/pgbouncer/pg_hba.conf
auth_file = /etc/pgbouncer/userlist.txt
auth_query = SELECT usename, passwd FROM pg_shadow WHERE usename = $1;
admin_users = pgbouncer
stats_users = monitoring,metrics
pool_mode = session
server_reset_query = DISCARD ALL
ignore_startup_parameters = extra_float_digits,search_path,ssl_renegotiation_limit
server_check_delay = 30
max_client_conn = 10000
default_pool_size = 1000
# min_pool_size = 5
max_db_connections = 1000
log_connections = 0
log_disconnections = 0
log_pooler_errors = 1
autodb_idle_timeout = 86400
server_lifetime = 0
server_idle_timeout = 600
server_connect_timeout = 10
server_login_retry = 30
client_tls_sslmode = require
client_tls_key_file = /etc/pgbouncer/certs/serverkey.pem
client_tls_cert_file = /etc/pgbouncer/certs/usercert.pem
server_tls_sslmode = verify-ca
server_tls_ca_file = /etc/pgbouncer/certs/rootca.pem
#### Example db include
foo01 = host=pg12-primary.example.tld port=5432 dbname=foo01 auth_user=pgbouncer
bar01 = host=pg12-primary.example.tld port=5432 dbname=bar01 auth_user=pgbouncer
### logrotate config
/var/log/pgbouncer/pgbouncer.log {
missingok
copytruncate
compress
notifempty
sharedscripts
create 0644 pgbouncer pgbouncer
nodateext
daily
rotate 6
postrotate
/bin/kill -HUP `cat /var/run/pgbouncer/pgbouncer.pid 2>/dev/null` 2> /dev/null || true
endscript
}
view thread (6+ messages) latest in thread
Message-ID: <gh-pgbouncer-pgbouncer-1697@github.com>
Permalink: ../gh-pgbouncer-pgbouncer-1697@github.com/
·
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox