-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix(postgres): prevent crash if postgres connection emit multiple errors #15867
Conversation
PR for version 6 : #15868 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to make the casing of the type a bit nicer
Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com>
Thanks for your input @WikiRik, I have updated the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I'll give @ephys some time to look at the typing change before I merge
Pull Request Checklist
Description Of Change
We recently observed multiple crashes due to an unhandled "server conn crashed?" exception originating from the pg library. As best as I've been able to tell, this shouldn't be possible and should have been fixed in this previous PR : #14731
I think that an error might be able to slip up during the connection without the error listener being properly attached or that error can be fired multiple times and is only handled once.
My fix is to attach the listener before trying to connect to the database. Also I change back the .once handler to a .on (this was changed in the PR 14731) to be able to catch multiple errors.
Todos