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
acquireTimeout not working for idleConnections > 0 #116
Comments
|
allright, found and reproduced the issue. Correction will be done quickly. |
…imeout set #116 Pool option `acquireTimeout` ensure that pool.getConnection() throw an error if there is no available connection after this timeout is reached. When connection stays in pool unused for some time (`minDelayValidation` option), pool will return those connection after a validation (PING to server). The issue is that when using proxy between client and server, socket to proxy might still be open, but proxy might be busy reconnecting server for an unknown amount of time. In those case, `acquireTimeout` is not respected, and pool.getConnection() might wait indefinitely. New option `pingTimeout`, defaulting to 250ms is added so validation is limited in time. Connection.ping() now has an optional Timeout parameter. If timeout is reached, promise is rejected and connection is force closed.
|
Ah yes, makes sense. I used xampp-vm for macOS, which runs the database in a local virtual machine. Thanks for the fix! |
…imeout set #116 Pool option `acquireTimeout` ensure that pool.getConnection() throw an error if there is no available connection after this timeout is reached. When connection stays in pool unused for some time (`minDelayValidation` option), pool will return those connection after a validation (PING to server). The issue is that when using proxy between client and server, socket to proxy might still be open, but proxy might be busy reconnecting server for an unknown amount of time. In those case, `acquireTimeout` is not respected, and pool.getConnection() might wait indefinitely. New option `pingTimeout`, defaulting to 250ms is added so validation is limited in time. Connection.ping() now has an optional Timeout parameter. If timeout is reached, promise is rejected and connection is force closed.
|
closing since released in 2.4.2 |
When idle connections are present while the database connection gets lost,
pool.getConnection()does not resolve with an error afteracquireTimeout.The reason seems to be that the pool tries to ping the server.
With default
socketTimeout: 0, this runs indefinitely.I looked into writing an integration test, but was not sure how to simulate "external connection loss".
Reproduce
Pool.pool.getConnection()=> does not time out.
The text was updated successfully, but these errors were encountered: