Repository navigation
Evict stale connections - #7924
Conversation
Added configuration property `evictionRunIntervalMillis` to node-pool instantiation to allow evictions to run against stale connections in the pool. The default value is set to 0 which prevents evictions all together. The added configuration will cause evictions to run every 60 seconds. The setting has been exposed in the Sequelize configuration options.
Corrected the existing default pooling options in `usage.md` and added new option for evict which controls the interval in which evictions run.
Adding `evictionTimeoutMillis` to remaining configuration areas within `connection-manager.js`
|
@felixfbecker It looks like you broke the CI with this commit 8d4700f Why are you committing directly to master to begin with? This is extremely risky and is bound to cause friction with both new PRs and on-going releases. |
I didn't. I merged a PR (which is linked in the commit message, btw) from Greenkeeper that updates ESLint, was approved by two other maintainers, passed locally and on CI on multiple jobs on Travis. It failed then on AppVeyor, Node 4, Windows, because for whatever black magic this line throws an error in that environment (but works on Linux Node 4, 6 and Windows Node 6). Apparently Node 4 is unable to parse JSON on Windows. Excuse me for valuing my free time in that moment higher than the absolute certainty of something so unpredictable not happening. |
There was a problem hiding this comment.
Please add the evict option to the sequelize constructor options
Line 82 in c902b07
|
My comment is still pending, please add the option to the api docs :) |
|
Sorry for pinging you! |
Updating the comment which documents the configuration parameters available when constructing a new _Sequelize_ object.
Updating the grammar for simplify the understanding of this option.
|
@janmeier Thanks for taking the time to review this PR and apologies for the lapse in time before addressing your feedback. I've updated the api docs in |
|
@sushantdhiman @janmeier Hi guys, can you please proceed with review, we need to merge it ASAP, otherwise we will need to downgrade sequelize version because of this issue: sidorares/node-mysql2#447 |
|
@euqen I will do the merge once CI shows the green flag :) |
|
@sushantdhiman great, thank you! |
|
Failing MSSQL builds should now be fixed after 05f3c6d I have updated this branch, its pretty late here in India 23:51 😆 , so any one with merge rights should merge this branch as soon as it gets green. |
|
@sushantdhiman thanks for merging. Can you please clarify for me when are you planning to create new release which includes this changes? Thanks |
|
Thanks for getting this released, but is this fix actually working for anyone else? The eviction scheduler doesn't seem to be getting called at all for me. I tracked it down to the |
|
#8126 addresses this issue, but we cant just set |
|
Looks like calling this will fix it in the meantime: sequelize.connectionManager.pool.start();I'm seeing the connections get evicted as expected now. |
|
This PR will also solve #8133 I think. (I'm also impacted by this using Sequelize 4.8.0 and Sequelize-cli 2.8.0, I tried the line above but it says that sequelize.connectionManager is undefined. Where do you run this inside a migration file?) |
|
@dtjohnson : Man, you saved my life. Past 2 days I am was breaking my head over this. Just in case if I am missing anything let me know. Thanks, |
Pull Request check-list
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Adding a new option to
defaultPoolingConfigfor overiding the default evictionRunIntervalMillis when instantiating connection pools usingnode-pool. You can see how evictions are never ran if this setting remains 0 https://github.com/coopernurse/node-pool/blob/master/lib/Pool.js#L351This PR is a bandaid for several recent "open" issues: #7884 and #7882 and possibly #7616