fix(postgres): prevent crash if postgres connection emit multiple errors#15868
fix(postgres): prevent crash if postgres connection emit multiple errors#15868WikiRik merged 5 commits intosequelize:v6from
Conversation
|
According to I wonder if adding the error listener inside of |
|
I have read the code handling the connection in But I do think that the pg connection can emit multiple errors and that is what is causing our crash, that's why I changed the |
WikiRik
left a comment
There was a problem hiding this comment.
Yes, putting it back to on seems fine to me
|
🎉 This PR is included in version 6.31.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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