-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Pool building freezes when connections drop during initial setup #142
Comments
The pool will retry after failed connection attemps: https://github.com/sfackler/r2d2/blob/master/src/lib.rs#L272-L278. Lowering the connection timeout will increase the rate at which those retries will be made. |
Ah I see, then the freeze might stem from another reason, but it certainly freezes. It normally logs reconnection attempts, but there is no output for like 5 minutes, even though the connection timeout is 30 seconds. |
I don't think I can see how it's possible for initialization to take longer than the connection timeout. A self contained example of your issue would be helpful. |
Hmm, I am not able to reproduce it in the setup I expected it to happen. It seems to maybe not be related to the pool start up even, so it might be a diesel or my own issue, so closing this for now! Thank you for the quick response and sorry for any inconvenience. |
Hi!
I am using r2d2 0.8.10 and noticed, that my service gets stuck on startup consistently under certain conditions: When the database becomes available, while r2d2 is already trying to connect.
The problem is, that in the initial startup phase, all connections are reset until postgresql is then fully start up.
During the build of the pool, the builder waits until the specified amount of connections is reached. However, it only starts connecting the specified amount of connections, so if one of those is dropped during the waiting time, the builder infinitely waits.
I hope this was understandable and thank you!
PS:
As a workaround, it seems to work to lower the
connection_timeout
, it somehow makes it way less likely to appear.The text was updated successfully, but these errors were encountered: