-
-
Notifications
You must be signed in to change notification settings - Fork 91
fix: do not handle errors during connection #616
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
Conversation
198a011 to
b599f4a
Compare
| {:noreply, put_in(state.meta, meta)} | ||
| else | ||
| reason -> | ||
| Logger.error(state.topology, "Failed to connect to Postgres: #{inspect(reason)}") |
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.
What happens when this fails loudly does it take down the whole app with it?
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.
I would need to check exactly, but in theory, if the failure happen repeatedly, then it can cause whole application to go down.
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.
does it take down the whole app with it?
No, Supervisor will try to restart the Postgres strategy process, and after exhausting the retries, it will just leave it unstarted. But that change doesn’t make much sense anyway, because the node will be out of the cluster in case of a Postgres failure. You probably want to forward already assigned values, send a connect message after a timeout, and handle them more gracefully
b599f4a to
c33107a
Compare
9c386f8 to
4d8320e
Compare
In case of failure in the following cases, the node will not handle notifications because there is no retry logic. So yeah, there’s a potential place for a bug, but it doesn’t lead to leaking connections |
a03fbbb to
1642320
Compare
This is potential source of a problem, as if there are is error in 2nd or 3rd clause of `with` then we are leaking connections which in the end may result in the connections exhaustion. Instead we should fail loudly that there is something wrong with the connections. It should also help with debugging potential problems.
1642320 to
c7b4c06
Compare
|
@hauleth I've closed that PR because there's already one in progress that adds auto_reconnect. So, to fix the current issue, just need to add auto_reconnect to the notification connection |
This is potential source of a problem, as if there are is error in 2nd or 3rd clause of
withthen we are leaking connections which in the end may result in the connections exhaustion. Instead we should fail loudly that there is something wrong with the connections. It should also help with debugging potential problems.