element-hq / element-hq/synapse

The database pool appears to leak connections if they fail to establish in `on_new_connection`

Open
#19,471 1 comment 0 reactions 0 assignees View on GitHub
A-Database O-Uncommon S-Major T-Defect
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.