From: ritojoao (@ritojoao) <noreply+ritojoao@github.com>
To: pgbouncer/pgbouncer <noreply+pgbouncer-pgbouncer@github.com>
Subject: Re: [pgbouncer/pgbouncer] PR #1703: Send cancellations to the query's backend
Date: Wed, 18 Nov 2026 19:09:41 +0000
Message-ID: <gh-pgbouncer-pgbouncer-1703-c6988742296@github.com> (raw)
In-Reply-To: <gh-pgbouncer-pgbouncer-1703@github.com>
References: <gh-pgbouncer-pgbouncer-1703@github.com>
Hi, and thank you for working on this. I tested the head of this PR (dc3eeff, which includes cef2802) as a user, and I wanted to share what I saw in case it helps.
Setup: two PostgreSQL 17 servers on 127.0.0.1 and 127.0.0.2, session pool, a query with `pg_sleep(3)`, and a cancel after 1 second. I ran 6 iterations per case, with my own small script.
Cancelled queries out of 6:
- `host=A,B` with round-robin: base 3/6, this PR 6/6
- `host=A,B` with `load_balance_hosts=disable`: 6/6 on all
- single host: 6/6 on all
So this PR fixes the problem from #1702 in my test. The separate change I proposed in #1710 gives the same numbers in these three cases, so I am happy if you prefer your approach, which also covers the case where the cancel must reach the exact backend address.
I also tried a rough script for the case where the first cancel in the queue leaves before the login ends (two clients on different servers, the first cancel closes its socket right away). I got 6/6 on this PR and 6/6 on my change, so I could not show a difference. I am not sure my script really hits that timing on localhost, so please treat it as not proven either way.
Test suite on this PR: `make -C test check` passed. pytest gave 287 passed and 8 skipped. Two failures in test_misc.py (`test_server_check_query_default_negative` and `test_server_check_query_negative`) also fail on the base commit in my environment. `test_prepared_failed_prepare_pipeline` failed once in the full run and passed 3 of 3 when run alone, so it may be flaky, but I only ran the full suite once on this PR.
What I could not check: the two new tests `test_cancel_uses_query_backend_host` and `test_cancel_not_forwarded_to_other_host` did not run in my container, because the second PostgreSQL on 127.0.0.2 could not bind its port ("Address already in use"). This is probably a problem with my setup and not with the PR, but I did not confirm it. I also did not test peering, TLS, IPv6, a host removed by reload, or a down host.
Thanks again, and please tell me if I should run anything else.