New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix rejected connection on pause #420
base: master
Are you sure you want to change the base?
fix rejected connection on pause #420
Conversation
3bdba8f
to
5acd380
Compare
It also looks like fixing 5-30-seconds stalls after RECONNECT, which appeared for the same reasons: a pool was incorrectly marked as |
This is how I simulated the client load:
|
I've tidies up |
Sometimes, when executing PAUSE command, a connection may be refused. It turned out to happen when PAUSE finds a server connection in a login state. In this situation the server connection, according to PAUSE semantics, is closed, but it also marks the pool as
last_login_failed
andlast_connect_failed
. This may sometimes prevent reconnecting to a server, resulting in a client connection rejected.To reproduce: make frequent random connections, disconnections and simple query executions with pgboucner concurrently (I can provide a python script if needed). In another console do
psql -p 5433 -d pgbouncer -c 'pause'; psql -p 5433 -d pgbouncer -c 'resume';
. From time to time the python script gets connection rejected.The patch is to fix it. For now it's mostly a proof of concept, and a request for comments to the idea. Perhaps it's worth joining
disconnect_server
anddisconnect_server_noblame
into a single function with an extra argument, as well as tidying up the code a bit.