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

Do not allow exceptions escape when closing broken connection #384

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

pulyaevskiy
Copy link
Contributor

This addresses an issue I hit while running my server app in Docker (Swarm). Postgres was also running in the same swarm.

I was getting a "connection reset by peer" errors after a few minutes of idle operation, which seemed like were being handled by the library.

But trying to establish a new connection always resulted in a crash of my up with Unhandled exception saying "connection reset by peer" (again).

I tried to understand what's the best way to handle it inside the lib but it's still unclear to me where exactly it originates from.

The only thing that worked is adding try-catch in the _close method and silencing the error, which seems reasonable.

Note: The lib does throw PgException (which wraps the original SocketError) on a call to execute and I tried catching it, and re-creating the connection. But the SocketError reappears as unhandled later, after calling open and crashes the app completely.

@isoos
Copy link
Owner

isoos commented Nov 2, 2024

I think this is reasonable, thank you!

@isoos isoos merged commit 3352978 into isoos:master Nov 2, 2024
1 check passed
@isoos
Copy link
Owner

isoos commented Nov 2, 2024

Published as 3.4.1

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

Successfully merging this pull request may close these issues.

2 participants