Skip to content

Delay pgbouncer preStop shutdown to avoid dropped connections during …#69608

Open
bramhanandlingala wants to merge 1 commit into
apache:mainfrom
bramhanandlingala:fix/#69571
Open

Delay pgbouncer preStop shutdown to avoid dropped connections during …#69608
bramhanandlingala wants to merge 1 commit into
apache:mainfrom
bramhanandlingala:fix/#69571

Conversation

@bramhanandlingala

Copy link
Copy Markdown
Contributor

Description

pgbouncer's preStop hook was signaling shutdown immediately with killall -INT pgbouncer, which meant the pod could exit before Kubernetes finished removing it from Service routing. Since pgbouncer exits as soon as its in-flight queries drain — often in well under a second for a lightly loaded pod — new connections kept getting routed to a pod that had already shut down, causing the dropped connections during rolling restarts described in #69571.

The fix adds a short sleep before signaling shutdown, so Kubernetes has time to mark the pod as Terminating and propagate that to Service endpoints while pgbouncer is still accepting connections. Only after that does it send the interrupt signal to drain and stop pgbouncer. The updated command is sleep 10 && killall -INT pgbouncer && sleep 20, and the same string was updated consistently across values.yaml, values.schema.json, and the existing test in test_container_lifecycle.py that asserts on it.

related: #69571

@boring-cyborg boring-cyborg Bot added the area:helm-chart Airflow Helm Chart label Jul 8, 2026
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:helm-chart Airflow Helm Chart ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants