Decagon
Decagon logoDecagon · Feature trail

PgBouncer Debugging and Migration

1 post · Aug 2026

What this trail covers

Decagon successfully migrated from GCP's managed connection pooler to self-managed PgBouncer. This migration uncovered a latent bug in PgBouncer related to TLS buffering and packet handling, which caused connection stalls and pool exhaustion. The issue was mitigated by shortening the application name parameter and an upstream fix was contributed to PgBouncer to address the event loop deadlock. The investigation traced the bug through SQLAlchemy, PgBouncer, OpenSSL, and the Linux kernel's epoll interface.

All Decagon trails