-
Notifications
You must be signed in to change notification settings - Fork 51
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
SqlgGraph do not close data source in case of error in open #322
Comments
@pietermartin I have created a pull request with the fix, but I am not able to run the end-to-end tests since I am not sure what are the steps for it. Can you please pull this branch and run end-to-end to verify nothing is broken before we can merge it it? |
You should change the postgresql port to be able to test on your side. That said I think it will be better if I make |
I merged the PR and ran the tests. However I have not yet written a test to cover this scenario so please test it on your side. |
Thanks for merging it in. I have verified on my side that collections are no longer leaking in this scenario.
|
We are using SqlgGraph against a HA setup of postgres with one primary and another secondary (read only slave).
We have setup observers to notify when postgres fails-over and we re-construct the SqlgGraph using
SqlgGraph.open(configuration)
.Though, it is possible that secondary instance is still not ready to accept write traffic and
SqlgGraph.open(configuration)
fails. It can also happen when we are building the sqlg graph for the first time. So there are many paths in the code which can fail because postgres is not accepting write traffic.In these scenarios, we retry opening the SqlgGraph if it fails. Though we are noticing that after few tries, postgres runs out of connections and fails with following error.
This is because
SqlgDataSource
is not closed on error paths and holds on to the connection pool until garbage collector sweeps it. Since it can be a while before garbage collector kicks in, we are seeing these no connection left error.I tried a fix locally to explicitly close
SqlgDataSource
on error paths, but I do not correct setup locally and all tests are failing (as well few packages failed to build) with error.Can you please look into this issue yourself or document development guide for this project?
The text was updated successfully, but these errors were encountered: