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

Database Reconnect #53

Open
dustin-H opened this issue Jun 1, 2019 · 6 comments
Open

Database Reconnect #53

dustin-H opened this issue Jun 1, 2019 · 6 comments
Assignees

Comments

@dustin-H
Copy link
Collaborator

dustin-H commented Jun 1, 2019

When Aiven is switching the Database due to automatic maintenance one seems not to be able to reconnect properly.

Also, the server does not crash, which would trigger a restart and thus a reconnect.

Currently it just loses the database-connection and gets unresponsive.

@terehov
Copy link
Contributor

terehov commented Jun 1, 2019

I’ll look into that.
Meanwhile:

A pg.Pool will handle this for you, even if you never want more than one client.

brianc/node-postgres#1558

@dustin-H
Copy link
Collaborator Author

dustin-H commented Jun 1, 2019

Okey, just another hint for that.

In the logs I can see some errors like this:
Error: connect ETIMEDOUT xx.xxx.xx.xxx:12345

However, Aiven is changing the IP-Address with that maintenance:

NOTE: The DNS name of the service will remain the same while maintenance is being performed, but the underlying IP address will change.

Maybe pg.Pool is not trying to connect to the DNS-Name once resolved and keeps trying to connect to the IP-Address resolved at some point before.

@terehov
Copy link
Contributor

terehov commented Jun 1, 2019

@dustin-H what should be the expected behavior? Trying to reconnect or exit the entire app? Since the state after a lost connection is “undefined”, I would prefer to just exit the entire program (and restart).

@dustin-H
Copy link
Collaborator Author

dustin-H commented Jun 1, 2019

Yes, I'd also prefer just stopping the process.

@davidsparkles
Copy link
Collaborator

We need to check, whether this is still a problem when using Typeorm or whether they can handle it.

@dustin-H
Copy link
Collaborator Author

dustin-H commented Sep 4, 2019

This is still the case with Typeorm.

@terehov terehov self-assigned this Sep 4, 2019
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

No branches or pull requests

3 participants