Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to enable TCP keepalive on Postgres client connections #3540

Open
psFried opened this issue Oct 2, 2024 · 2 comments · May be fixed by #3559
Open

Add the ability to enable TCP keepalive on Postgres client connections #3540

psFried opened this issue Oct 2, 2024 · 2 comments · May be fixed by #3559
Labels
enhancement New feature or request

Comments

@psFried
Copy link

psFried commented Oct 2, 2024

Is your feature request related to a problem? Please describe.

We've observed some issues where our application hangs, though it's not necessarily certain that TCP keepalive would have prevented them.

Describe the solution you'd like

We'd like to enable TCP keepalive on our postgres client connections.

Describe alternatives you've considered

I've seen #3060 , and would agree that application-level timeouts are certainly more robust. But TCP keepalive is still useful, even once application-level timeouts are more well supported. For example, an application that's executing long-running queries might be able to detect a broken connection much more quickly with keepalive than it would with an application-level timeout. While keepalive is quite broadly supported, as pointed out in #3060 it's not universally supported. So this would need to be an option. Adding something on PgConnectionOptions seems pretty doable, but a compile-time feature could also work.

@psFried psFried added the enhancement New feature or request label Oct 2, 2024
@abonander
Copy link
Collaborator

Adding something on PgConnectionOptions seems pretty doable

This is reasonable. I'd accept a PR for this.

@xuehaonan27
Copy link
Contributor

I have tried to add this feature to sqlx in PR #3559 .
Humbly I request your review @abonander and I'm willing to make changes to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants