Day 7: Failover and pooler
Goal: Switch the primary in a planned and an unplanned way while load is running, find a bug in the connection pool of
kurzand fix it with a single parameter, set up PgBouncer as CNPG’s pooler and measure what it brings during a failover and what it does not · Duration: approx. 100 min · Prerequisite: Day 6
Briefing
- In the predecessor course a failover took manual work:
pg_promote(), changing connection URLs, reconfiguring PgBouncer. CNPG does both itself. There are two ways to change the primary:
| Switchover | Failover | |
|---|---|---|
| Occasion | planned: maintenance, node update | unplanned: primary gone |
| Sequence | old primary stops in an orderly way, a replica is promoted | CNPG detects the outage, promotes the most up-to-date replica |
| Data loss | none | with asynchronous replication, the last changes not yet transferred |
- In both cases the address behind
db-rwchanges. Whetherkurzsurvives that well is not decided by CNPG but by the connection pool inkurz. - A pooler (PgBouncer) sits between the application
and the database and shares a few database connections among many
clients. CNPG runs it with a resource
Pooler.
Drill 1: The kubectl cnpg plugin
There is an official plugin for switchover, status and more. The
package file names are inconsistent: x86_64 for amd64, but
arm64 for arm64.
# on s1
# Working directory
mkdir -p ~/sdk/tag07 && cd ~/sdk/tag07
# Architecture in the package naming scheme: amd64 -> x86_64, arm64 stays
A=$(dpkg --print-architecture | sed s/amd64/x86_64/); echo $A
# Package and checksums of the same version as the operator (1.30.2)
curl -sLO https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.30.2/kubectl-cnpg_1.30.2_linux_${A}.deb
curl -sLo sums.txt https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v1.30.2/cnpg-1.30.2-checksums.txt
# Verify the checksum, then install
grep " kubectl-cnpg_1.30.2_linux_${A}.deb$" sums.txt | sha256sum -c -
sudo dpkg -i kubectl-cnpg_1.30.2_linux_${A}.deb | tail -1
# Cluster state, compact
kubectl cnpg status db -n kurz | sed -n '/Instances status/,$p'Expected:
x86_64
kubectl-cnpg_1.30.2_linux_x86_64.deb: OK
Setting up cnpg (1.30.2) ...
Instances status
Name Current LSN Replication role Status QoS Manager Version Node
---- ----------- ---------------- ------ --- --------------- ----
db-1 0/3C000060 Primary OK BestEffort 1.30.2 s1
db-2 0/3C000060 Standby (async) OK BestEffort 1.30.2 s2
db-3 0/3C000060 Standby (async) OK BestEffort 1.30.2 s3
Save your progress? Sign up for free
Drill 2: A planned switch
Load as on Day 4: 800 requests per second, 10 % of them new links.
After ten seconds, db-2 becomes the primary.
# on s1
# Manifest, codes and load script (90 % reads, 10 % writes)
cp ../tag06/kurz.yaml ../tag06/codes.txt ../tag04/mix.js .
# 60 s of load in the background
(ZIEL=http://172.16.0.126 RATE=800 DAUER=60s k6 run --quiet mix.js > k6-switchover.txt 2>&1 &)
# After 10 s: make db-2 the primary
sleep 10; date +%T; kubectl cnpg promote db db-2 -n kurz
# Every 4 s: who is primary, which phase is the cluster in?
for i in $(seq 12); do
printf "%s primary=%s phase=%s\n" $(date +%T) $(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}') \
"$(kubectl -n kurz get cluster db -o jsonpath='{.status.phase}' | tr ' ' _)"
sleep 3
done
# End of the load, result, and what kurz logged
sleep 15
grep -E 'http_req_duration\.|http_req_failed\.|http_reqs\.' k6-switchover.txt | sed 's/ */ /g'
kubectl -n kurz logs -l app=kurz --since=90s --tail=-1 | cut -c21- \
| sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+/ADDR/g' | sort | uniq -c | sort -rn | head -4Expected (abridged):
08:53:58
Node db-2 in cluster db will be promoted
08:53:59 primary=db-1 phase=Switchover_in_progress
08:54:03 primary=db-2 phase=Switchover_in_progress
08:54:17 primary=db-2 phase=Switchover_in_progress
08:54:21 primary=db-2 phase=Cluster_in_healthy_state
http_req_duration..............: avg=17.82ms min=1.29ms med=6.41ms max=2.06s p(90)=19.95ms p(95)=31.96ms
http_req_failed................: 8.05% 3850 out of 47771
http_reqs......................: 47771 796.126948/s
167 anlegen: context deadline exceeded
7 anlegen: FATAL: terminating connection due to administrator command (SQLSTATE 57P01)
1 kurz-7b8b664fdf-vrzvf: Sicherung offen für 5s (88 Fehler in Folge)
1 kurz-7b8b664fdf-vrzvf: Sicherung offen für 5s (87 Fehler in Folge)
After four seconds db-2 is the primary, after 22 seconds
CNPG reports “healthy”. Even so, 8 % of all requests
fail. That is almost all writes of the whole minute. The “Sicherung” in
the log is the circuit breaker from the predecessor course (Day 13):
after five errors in a row (Fehler in Folge),
kurz rejects writes immediately for five seconds
(offen = open) and then lets one probe through. The probe
fails again every time.
Does kurz write at all after the switch?
# on s1
# Create three links, wait at most 5 s
for i in 1 2 3; do
curl -s -m 5 -o /dev/null -w "POST -> %{http_code} %{time_total}s\n" -X POST -H "Content-Type: application/json" \
-d "{\"url\":\"https://example.org/tag07/test-$i\"}" http://172.16.0.126/api/links
done
# Where does db-rw point?
kubectl -n kurz get endpointslices -l kubernetes.io/service-name=db-rw -o jsonpath='{range .items[*].endpoints[*]}{.targetRef.name}{"\n"}{end}'
# Which connections does kurz hold to which instance?
for p in db-1 db-2 db-3; do echo "== $p"; kubectl -n kurz exec $p -c postgres -- psql -tAc "select client_addr, state from pg_stat_activity where usename = 'kurz'"; doneExpected (abridged):
POST -> 503 2.012465s
POST -> 503 2.009407s
POST -> 503 0.006616s
db-2
== db-1
== db-2
== db-3
10.42.0.58|idle
10.42.0.58|idle
10.42.2.45|idle
10.42.2.45|idle
No. db-rw correctly points to db-2, the
database is healthy, but kurz has not a single
connection to the new primary, only its read connections to
db-3. A look into the network namespace of a
kurz Pod shows where it is stuck:
# on s1 (a kurz Pod runs there; otherwise on its node)
# Network namespace of the kurz process: TCP connections to port 5432 by state
P=$(pgrep -x kurz | head -1)
sudo nsenter -t $P -n ss -tan | grep 5432 | awk '{print $1, $5}' | sort | uniq -cExpected:
2 ESTAB 10.43.199.194:5432
4 SYN-SENT 10.43.45.241:5432
Four connection attempts to db-rw (10.43.45.241)
are stuck in SYN-SENT. Four is exactly the size of
the kurz write pool (Day 2). During the switch, connection
attempts went nowhere and were never answered. Without a setting, pgx
has no timeout for establishing a connection; the
kernel retransmits the SYN packet until it gives up after roughly two
minutes. Until then the hanging attempts occupy all slots in the pool,
and every write waits for a free slot until its own two-second timeout
expires.
Happened during testing: The bug showed up the same way on two switches in a row. About 125 seconds after the switch, writing worked again on its own each time; a
kubectl rollout restartof thekurzPods helped immediately. Why the SYN packets go unanswered at that moment instead of being rejected right away: the kernel’s connection tracking (conntrack) shows them without translation to a Pod address;db-rwhad no endpoint at that instant. For the fix it does not matter.
Save your progress? Sign up for free
Drill 3: A timeout for establishing connections
The same pattern as on Day 4 with Envoy
(connectTimeout): every connection attempt needs its own,
short timeout. pgx understands the parameter
connect_timeout (seconds) in the connection URL:
# on s1
# Append connect_timeout=2 to both connection URLs
sed -e 's#@db-rw:5432/kurz#@db-rw:5432/kurz?connect_timeout=2#' \
-e 's#@db-ro:5432/kurz#@db-ro:5432/kurz?connect_timeout=2#' ../tag06/kurz.yaml > kurz.yaml
diff ../tag06/kurz.yaml kurz.yaml
# Apply and wait
kubectl apply -f kurz.yaml >/dev/null && kubectl -n kurz rollout status deploy/kurz | tail -1
# Function wechsel: 60 s of load, after 10 s promote whichever of db-1/db-2 is not primary, show the result
wechsel() {
until [ "$(kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances}')" = 3 ]; do sleep 3; done
P=$(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}')
Z=$([ $P = db-1 ] && echo db-2 || echo db-1); echo "Wechsel $P -> $Z"
(ZIEL=http://172.16.0.126 RATE=800 DAUER=60s k6 run --quiet mix.js > k6-$1.txt 2>&1 &)
sleep 10; kubectl cnpg promote db $Z -n kurz | tail -1; sleep 55
grep -E 'http_req_failed\.|http_reqs\.' k6-$1.txt | sed 's/ */ /g'
}
# Switch with the timeout, then a write test
wechsel timeout
for i in 1 2 3; do
curl -s -m 5 -o /dev/null -w "POST -> %{http_code} %{time_total}s\n" -X POST -H "Content-Type: application/json" \
-d "{\"url\":\"https://example.org/tag07/ct-$i\"}" http://172.16.0.126/api/links
doneExpected:
51c51
< value: postgres://kurz:$(DB_PASSWORT)@db-rw:5432/kurz
---
> value: postgres://kurz:$(DB_PASSWORT)@db-rw:5432/kurz?connect_timeout=2
53c53
< value: postgres://kurz:$(DB_PASSWORT)@db-ro:5432/kurz
---
> value: postgres://kurz:$(DB_PASSWORT)@db-ro:5432/kurz?connect_timeout=2
deployment "kurz" successfully rolled out
Wechsel db-1 -> db-2
Node db-2 in cluster db will be promoted
http_req_failed................: 1.37% 658 out of 47810
http_reqs......................: 47810 796.71122/s
POST -> 201 0.016586s
POST -> 201 0.021341s
POST -> 201 0.012149s
From 8 % down to 1.37 %, and writing works again
right after the switch. The remaining errors fall into the seconds of
the switch itself: the old primary terminates its connections
(57P01), the new one is not reachable yet, and the circuit
breaker of kurz keeps rejecting for a few seconds
afterwards.
Save your progress? Sign up for free
Drill 4: PgBouncer as pooler
CNPG runs PgBouncer with its own resource. type: rw
means: the pooler connects to the primary. In transaction
mode, a database connection belongs to a client only for the duration of
one transaction; in between, another client gets it.
# on s1
# Pooler: 2 PgBouncer instances, transaction mode, at most 10 server connections per instance
cat > pooler.yaml <<EOF
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
name: db-pooler-rw
namespace: kurz
spec:
cluster:
name: db
instances: 2
type: rw
pgbouncer:
poolMode: transaction
parameters:
default_pool_size: "10"
max_client_conn: "500"
EOF
# Create; the Deployment only appears after a few seconds
kubectl apply -f pooler.yaml && sleep 5
kubectl -n kurz rollout status deploy/db-pooler-rw
# Where do the PgBouncers run, which version?
kubectl -n kurz get pods -l cnpg.io/poolerName=db-pooler-rw -o wide --no-headers | awk '{print $1, $2, $7}'
kubectl -n kurz exec deploy/db-pooler-rw -c pgbouncer -- pgbouncer --versionExpected:
pooler.postgresql.cnpg.io/db-pooler-rw created
deployment "db-pooler-rw" successfully rolled out
db-pooler-rw-77fc8bd78-c6fdb 1/1 s2
db-pooler-rw-77fc8bd78-hqzms 1/1 s1
PgBouncer 1.26.1
From now on kurz writes through the pooler; reads stay
directly on db-ro:
# on s1
# Keep a copy of the direct variant, then replace db-rw with db-pooler-rw
cp kurz.yaml kurz-direkt.yaml
sed -i 's#@db-rw:5432/kurz?connect_timeout=2#@db-pooler-rw:5432/kurz?connect_timeout=2#' kurz.yaml
diff kurz-direkt.yaml kurz.yaml
# Apply, create three links, 20 s of load
kubectl apply -f kurz.yaml >/dev/null && kubectl -n kurz rollout status deploy/kurz | tail -1
for i in 1 2 3; do
curl -s -m 5 -o /dev/null -w "POST -> %{http_code}\n" -X POST -H "Content-Type: application/json" \
-d "{\"url\":\"https://example.org/tag07/pooler-$i\"}" http://172.16.0.126/api/links
done
ZIEL=http://172.16.0.126 RATE=800 DAUER=20s k6 run --quiet mix.js 2>/dev/null \
| grep -E 'http_req_duration\.|http_req_failed\.|http_reqs\.' | sed 's/ */ /g'Expected:
51c51
< value: postgres://kurz:$(DB_PASSWORT)@db-rw:5432/kurz?connect_timeout=2
---
> value: postgres://kurz:$(DB_PASSWORT)@db-pooler-rw:5432/kurz?connect_timeout=2
deployment "kurz" successfully rolled out
POST -> 201
POST -> 201
POST -> 201
http_req_duration..............: avg=11.29ms min=1.87ms med=6.58ms max=361.2ms p(90)=22.82ms p(95)=35.82ms
http_req_failed................: 0.00% 0 out of 15995
http_reqs......................: 15995 799.299128/s
No errors. That is not a given: pgx uses prepared statements, and for a long time they did not work with PgBouncer in transaction mode, because the next transaction can land on a different server connection. Since PgBouncer 1.21 the pooler tracks them itself; with 1.26 this is on without any setting.
Save your progress? Sign up for free
Drill 5: Failover with the pooler
# on s1
# Switch through the pooler, with PgBouncer's default values
wechsel pooler
# What kurz logged meanwhile
kubectl -n kurz logs -l app=kurz --since=80s --tail=-1 | cut -c21- \
| sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+/ADDR/g; s/kurz-[a-z0-9]+-[a-z0-9]+/POD/' | sort | uniq -c | sort -rn | head -3Expected:
Wechsel db-2 -> db-1
Node db-1 in cluster db will be promoted
http_req_failed................: 5.40% 2582 out of 47746
http_reqs......................: 47746 795.502275/s
137 anlegen: context deadline exceeded
10 anlegen: FATAL: server login has been failing, cached error: password authentication failed for user "kurz" (server_login_retry) (SQLSTATE 08P01)
5 anlegen: FATAL: terminating connection due to administrator command (SQLSTATE 57P01)
Worse than without the pooler. Two PgBouncer settings work against you here:
| Parameter | Default | Effect during the switch |
|---|---|---|
server_login_retry |
15 s | If a login to the server fails once, PgBouncer rejects every new server connection for 15 s and reports the remembered error |
server_connect_timeout |
15 s | the same problem as in Drill 2, one level down: PgBouncer waits up
to 15 s for the connection to db-rw |
The login fails because CNPG has passwords checked via a query on the
server (auth_query), and that very server is switching
right now. Lower both values:
# on s1
# server_login_retry 1 s, server_connect_timeout 2 s
sed -i 's/ max_client_conn: "500"/ max_client_conn: "500"\n server_login_retry: "1"\n server_connect_timeout: "2"/' pooler.yaml
# Apply; CNPG reloads the configuration without a restart
kubectl apply -f pooler.yaml && sleep 10
kubectl -n kurz exec deploy/db-pooler-rw -c pgbouncer -- grep -h 'server_connect_timeout\|server_login_retry' /controller/configs/pgbouncer.ini
# One more switch
wechsel pooler-kurzExpected:
pooler.postgresql.cnpg.io/db-pooler-rw configured
server_connect_timeout = 2
server_login_retry = 1
Wechsel db-2 -> db-1
Node db-1 in cluster db will be promoted
http_req_failed................: 1.79% 858 out of 47783
http_reqs......................: 47783 796.180423/s
| Switchover under load (800/s, 10 % writes) | Errors |
|---|---|
direct, pgx without connect_timeout |
8.05 %, writes hang ~2 min |
direct, connect_timeout=2 |
1.37 % |
| pooler with default values | 5.40 % |
pooler, server_login_retry 1 s,
server_connect_timeout 2 s |
1.79 % |
The pooler does not shorten the outage. What counts are short timeouts on every level where a connection is established: in the application, in the pooler, in the Gateway (Day 4).
Save your progress? Sign up for free
Drill 6: What the pooler really brings
Its benefit lies in the number of connections. Count who is connected to the primary:
# on s1
# Connections on the current primary by user
P=$(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}')
kubectl -n kurz exec $P -c postgres -- psql -tAc \
"select usename, count(*) from pg_stat_activity where usename in ('kurz', 'cnpg_pooler_pgbouncer') group by 1 order by 2 desc"Expected:
kurz|6
cnpg_pooler_pgbouncer|2
Six server connections as kurz, all from the PgBouncer
instances, plus two for their password checks.
default_pool_size sets the maximum: 10 per PgBouncer, so
20. Without a pooler, every kurz Pod opens its own pool.
With two Pods that does not matter, but on Day 9 the HPA scales to ten
and more Pods. 20 Pods with 4 to 8 connections each are 80 to 160
connections, and PostgreSQL allows 100 here
(max_connections, Day 1). The pooler makes the number of
database connections independent of the number of Pods.
Save your progress? Sign up for free
Drill 7: An unplanned outage
Now the primary simply disappears:
# on s1
# Current primary, 60 s of load, force-delete the primary Pod after 10 s
P=$(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}'); echo "Primary $P"
(ZIEL=http://172.16.0.126 RATE=800 DAUER=60s k6 run --quiet mix.js > k6-failover.txt 2>&1 &)
sleep 10; date +%T; kubectl -n kurz delete pod $P --grace-period=0 --force 2>&1 | tail -1
# Every 4 s: primary and phase
for i in $(seq 8); do
printf "%s primary=%s phase=%s\n" $(date +%T) $(kubectl -n kurz get cluster db -o jsonpath='{.status.currentPrimary}') \
"$(kubectl -n kurz get cluster db -o jsonpath='{.status.phase}' | tr ' ' _)"
sleep 4
done
# Result
sleep 20
grep -E 'http_req_failed\.|http_reqs\.' k6-failover.txt | sed 's/ */ /g'Expected:
Primary db-1
09:08:02
pod "db-1" force deleted from kurz namespace
09:08:03 primary=db-1 phase=Cluster_in_healthy_state
09:08:08 primary=db-1 phase=Failing_over
09:08:24 primary=db-1 phase=Failing_over
09:08:29 primary=db-2 phase=Waiting_for_the_instances_to_become_active
09:08:40 primary=db-2 phase=Waiting_for_the_instances_to_become_active
http_req_failed................: 6.18% 2957 out of 47800
http_reqs......................: 47800 796.16549/s
About 25 seconds until the new primary, compared with 4 seconds for the switchover, and 6.18 % errors. With a planned switch, CNPG knows what is coming; with an outage it first has to determine that the primary is gone and pick the most up-to-date replica. This difference is why maintenance is always done as a switchover and never by simply restarting the primary.
# on s1
# Wait until all three are ready again, then roles and a write test
until [ "$(kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances}')" = 3 ]; do sleep 3; done
kubectl cnpg status db -n kurz | sed -n '/Instances status/,$p'
curl -s -m 5 -o /dev/null -w "POST -> %{http_code}\n" -X POST -H "Content-Type: application/json" \
-d '{"url":"https://example.org/tag07/nach-failover"}' http://172.16.0.126/api/linksExpected:
Instances status
Name Current LSN Replication role Status QoS Manager Version Node
---- ----------- ---------------- ------ --- --------------- ----
db-2 0/4251A278 Primary OK BestEffort 1.30.2 s2
db-1 0/4251A278 Standby (async) OK BestEffort 1.30.2 s1
db-3 0/4251A278 Standby (async) OK BestEffort 1.30.2 s3
POST -> 201
The old primary has come back as a replica; CNPG brought it up to
date (pg_rewind) without you having to do anything.
Save your progress? Sign up for free
Exercise: Speed drills
- When was the current primary promoted? Target time: 1 min
- How many clients does each PgBouncer hold right now, and how many server connections? Target time: 3 min
- Why is
connect_timeout=2safe butconnect_timeout=0(no limit) dangerous, even though “0” sounds like “immediately”? Target time: 1 min
Solution
# on s1
# 1: time of the last promotion
kubectl cnpg status db -n kurz | grep 'Primary promotion time'
# 2: PgBouncer statistics via its admin console (database "pgbouncer") in the Pod
kubectl -n kurz exec deploy/db-pooler-rw -c pgbouncer -- psql -p 5432 -U pgbouncer pgbouncer -c 'show pools' \
| awk -F'|' 'NR==1 || /kurz/ {print $1 "|" $2 "|" $3 "|" $10 "|" $11 "|" $16}'Expected (columns abridged):
Primary promotion time: 2026-11-25 09:08:26 +0000 UTC (2m48s)
database | user | cl_active | sv_idle | sv_used | pool_mode
kurz | kurz | 3 | 0 | 3 | transaction
cl_active: clients currently connected (here the pools
of the kurz Pods that have reached this PgBouncer
instance). sv_*: server connections by state.
show pools shows only this one instance; the second has its
own numbers.
On 3: in libpq and pgx, 0 means “no timeout”, which is
exactly the behavior from Drill 2.
Save your progress? Sign up for free
Challenge
A colleague asks: “If the pooler does not make the failover shorter,
why not connect all applications directly to db-rw?” Answer
with two arguments for the pooler and one against it, each with a
reference to a measurement or number from this course.
Solution
For the pooler:
- Connections: the number of database connections no
longer depends on the number of Pods (Drill 6). On Day 9 the HPA scales
kurz; without a pooler the number of connections grows with it untilmax_connections(100) is reached. - One place for timeouts and switch behavior: instead
of equipping every application with
connect_timeoutand retries, you set it once at the pooler. Not every library knows such a parameter.
Against:
- One more hop with its own failure modes: in Drill
5,
server_login_retryturned a short switch into 5 % errors. Every layer needs its own tested settings, and it costs latency.
Save your progress? Sign up for free
Checkpoint
# on s1
# Three instances healthy
kubectl -n kurz get cluster db -o jsonpath='{.status.readyInstances} {.status.phase}{"\n"}'
# Pooler with two instances and the short timeouts
kubectl -n kurz get pooler db-pooler-rw -o jsonpath='{.spec.instances} {.spec.pgbouncer.parameters.server_login_retry} {.spec.pgbouncer.parameters.server_connect_timeout}{"\n"}'
# kurz writes through the pooler, with connect_timeout
kubectl -n kurz get deploy kurz -o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="KURZ_DB")].value}{"\n"}'
# Writing works
curl -s -o /dev/null -w "%{http_code}\n" -X POST -H "Content-Type: application/json" \
-d '{"url":"https://example.org/tag07/kontrollpunkt"}' http://172.16.0.126/api/linksExpected:
3 Cluster in healthy state
2 1 2
postgres://kurz:$(DB_PASSWORT)@db-pooler-rw:5432/kurz?connect_timeout=2
201
Interview note
- What decides how long a failover takes for users? Not only the operator (here 4 s planned, 25 s unplanned), but every connection layer in between: pool in the application, pooler, proxy. A single missing timeout for establishing connections turned seconds into two minutes here.
- PgBouncer modes:
session(one server connection per client session, hardly any savings),transaction(per transaction, the default for web applications; session state such asSETis lost),statement(per statement, only without transactions). - Switchover instead of restart: maintenance on the primary is always a planned switch.
Enterprise note
- Failover belongs in regular drills, with load and measurement, not just “the operator can do that”. No documentation shows today’s results (8 % vs. 1.4 %).
- CNPG can pause the pooler with
pgbouncer.pausedbefore maintenance: clients wait in the queue instead of getting errors. That is the tool for planned, longer interventions. - Many teams run one pooler per application (their own
Poolerresource), so that an application with a connection leak does not take up everyone else’s slots.