pgbouncer
pgbouncer copied to clipboard
Wildcard DB configuration lost on reload
my pgbouncer.ini without comments:
[databases]
* = host=::1 port=6432 auth_user=pgbouncer pool_size=100
[pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = ::1, 127.0.0.1, 172.16.16.2
listen_port = 5432
client_tls_sslmode=allow
client_tls_sslmode=allow
client_tls_ca_file=/etc/ssl/ca-bundle.pem
client_tls_key_file = /etc/pgbouncer/cert+key.pem
client_tls_cert_file = /etc/pgbouncer/cert+key.pem
client_tls_protocols = secure
client_tls_dheparams = auto
server_tls_sslmode = require
auth_type = hba
auth_file = /etc/pgbouncer/userlist.txt
auth_hba_file = /etc/pgbouncer/pg_hba.conf
auth_query=select * from pgbouncer.user_lookup($1);
admin_users = pgadmin
stats_users = pgadmin
pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 1024
default_pool_size = 100
This config works fine after a fresh start, after sending the reload signal. it starts to Pooler Error: login rejected for connections that were working until the restart. could this be caused by calling config_postprocess() in load_config()?
This is especially annoying as you would normally use sighup for reopening the log files after logrotate. For openSUSE I created this small patch to have a different signal for the logrotate job until this issue is fixed.
Index: pgbouncer-1.8.1/src/main.c
===================================================================
--- pgbouncer-1.8.1.orig/src/main.c
+++ pgbouncer-1.8.1/src/main.c
@@ -437,6 +437,7 @@ static void handle_sigint(int sock, shor
static struct event ev_sigusr1;
static struct event ev_sigusr2;
static struct event ev_sighup;
+static struct event ev_sigttin;
static void handle_sigusr1(int sock, short flags, void *arg)
{
@@ -476,6 +477,12 @@ static void handle_sighup(int sock, shor
log_info("Got SIGHUP re-reading config");
load_config();
}
+
+static void handle_sigttin(int sock, short flags, void *arg)
+{
+ log_info("Got SIGTTIN re-open logfiles");
+ reset_logging();
+}
#endif
static void signal_setup(void)
@@ -508,6 +515,11 @@ static void signal_setup(void)
err = signal_add(&ev_sighup, NULL);
if (err < 0)
fatal_perror("signal_add");
+
+ signal_set(&ev_sigttin, SIGTTIN, handle_sigttin, NULL);
+ err = signal_add(&ev_sigttin, NULL);
+ if (err < 0)
+ fatal_perror("signal_add");
#endif
signal_set(&ev_sigterm, SIGTERM, handle_sigterm, NULL);
err = signal_add(&ev_sigterm, NULL);
I can't reproduce that with a standard setup. Maybe it has something to do with the authentication setup you have. Can you play around with that a bit and see what makes a difference?
what do you want me to test? the set up we use is basically the example with the SQL query.
@darix is this still an issue with recent versions of pgbouncer ?
I am still using the patch described above. So I havent tested that in a long long time.
I think having a signal for just reopening log files makes the whole logrotate bit cheaper anyway.