-
Notifications
You must be signed in to change notification settings - Fork 122
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
NimblePool.checkout :idle_timeout When setting pool_max_idle_time
#291
Comments
Hey @mathieurousseau! I'm suspecting that this may be a issue of how idle termination is done on finch. It stops the pool when the first connection becomes idle and not all of them. I'm not sure if this is the semantics we need here, and it's not clear how to achieve proper semantics with the current implementation of nimble_pool's idle ping feature. Gona take a look at it. Is this bug consitently reproducible? What I think may be happening is something like this:
|
I recently got similar errors in my logs and switched finch to the patched version from #292 by @oliveigah for testing. (Note: finch or nimble_pool were not upgraded before this started to occur, though another dependency also using NimblePool was upgraded; not sure if related) Unfortunately the patch did not seem to fix this as today this showed up in logs again:
If I’m reading the application code correctly, |
Hey @TheOneric, thanks for your input. I've taken another look at the code, and the only way I can see this still happening with my proposed changes in #292 is if the work you're doing after checking out a connection takes longer than the pool_max_idle_time. This seems to be the case since your pool_max_idle_time is set to only 5 seconds. The reasoning behind this is:
I think a good change would be to track whether a connection is currently checked out before terminating it due to idle verification. I'll work on this and then we can check if it resolves the issue for you. In the meantime, you can try increasing your pool_max_idle_time to see if it helps. |
Thanks! I now increased the It being set to only 5 seconds by default before might actually be a bug in the application as it kind of seems like two app config options got confused. |
@TheOneric, I've updated my branch in #292 to include an "in-use" verification to prevent idle termination while a connection is checked out. If you could test it and report back on the PR, that would be great! |
Thanks for the quick update! I reverted to a 5s pool timeout and am testing the new patch now; if the error doesn't return in a couple days to a week, I’ll let you know |
Hello
We added a
pool_max_idle_time
to pool configuration.We then started to have the following issue:
connection max idle time is 10_000
pool max idle time is 20_000
If we let it empty (:infinity). We have no issue.
Thanks.
Mathieu
The text was updated successfully, but these errors were encountered: