element-hq / element-hq/synapse
The database pool appears to leak connections if they fail to establish in `on_new_connection`
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
2026-02-12
On matrix.org, our pgCat (external connection pool) was returning an `AllServersDown` error in response to `cursor.execute("SET bytea_output TO escape")`.
The number of file descriptors increased at a roughly linear rate, well past 3k until manually restarted.
Equally, the monitoring pgCat showed the same number of 'Idle Clients', which is normally 0.
I haven't done anything to confirm my initial hypothesis that we are leaking connections if `on_new_connection` fails.
Contributor guide
Research direction
Start with the connection-pool path around on_new_connection and reproduce the failure from cursor.execute("SET bytea_output TO escape"). Confirm whether failed initialization leaves connections or idle clients behind; done means the suspected leak is either demonstrated with a focused regression check or ruled out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100