I'm using the @mysql/xdevapi npm package (version 8.0.22) with a local installation of mysql-8.0.15-winx64.
I have set pooling to enabled and attempted to retrieve a session from the client. If I do this before mysql is ready then I get an ECONNREFUSED exception which is expected, but the connection never appears to be released. If the pool size is one then all subsequent attempts to getSession
The exception is thrown from within the getSession method, so the session is not returned for me to call .end()
manually.
const mysqlx = require('@mysql/xdevapi');
const client = mysqlx.getClient(config, { pooling: { enabled: true, maxSize: 1, queueTimeout: 2000 } });
const session = await this.client.getSession(); // returns ECONNREFUSED exception
/*
wait for mysql to be ready and accepting connections
*/
const session = await this.client.getSession(); // returns connection pool queue timeout exception because the previous session hasn't been returned to the pool
How can I ensure that the aborted connection is returned to the pool?