Repository navigation
Conversation
…uses idle connections never get evicted
|
@RayneHwang That was fast! |
There was a problem hiding this comment.
@RayneHwang The config autostart doesn't appear the issue for evictions not being checked. Instead, have you considered adding evictionRunIntervalMillis: 60000 to the configuration? The default evictionRunIntervalMillis is set to never process evictions. By setting it to 60000, we can process evictions every minute. You can see how evictions are never ran if this setting remains 0 https://github.com/coopernurse/node-pool/blob/master/lib/Pool.js#L351
softIdleTimeoutMillis is not needed as idleTimeoutMillis supercedes it. It's not changing the pool configuration and can be removed.
I'm not sure why the spec is failing, it appears unrelated to your PR though and something to do with the code coverage report.
@mphilpot Can you take a look?
|
@RayneHwang I've opened #7924 to resolve for stale connections by ensuring evictions are ran. |
|
@swordfish444 I've tested your PR in my project, doesn't seem to successfully evict stale connections.
if (config.softIdleTimeoutMillis < idleTime && config.min < availableObjectsCount) {
return true; // because softIdleTimeoutMillis is -1, always return true when still have connections available in pool
}
if (config.idleTimeoutMillis < idleTime) {
return true;
}So every time
|
|
As a workaround you can call |
|
The |
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
As described in issue #7882 , current pool confiuration in
/lib/dialects/abstract/connection-manager.jsinitPool method setsautostartto false when no replication is configured, which causes generic-pool_scheduleEvictorRuncheck routine never gets invoked. As a result idle connections never get evicted even if the database server's already closed the connection.To fix that problem, simply set
autostartoption to true and the evict check routine gets scheduled.As documented in node-pool, the
softIdleTimeoutMillis(default to -1 ) is checked beforeidleTimeoutMillis, so ifsoftIdleTimeoutMillisis not set, the connection will be considered stale no matter whatidleTimeoutMillisis