-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Node process can't finish correctly after creation of Connection Pool #1917
Comments
Thanks for your research. Can confirm this issue, clearing idle timer on pool end seems to solve it. I'll work on a fix & unit test |
I'm running into this issue also when running tests with Any suggested workarounds to more cleanly shutdown? |
@jeremysf As a work around, you can use mocha's |
I've this issue too, I workaround this by just remove maxIdle |
I also have this issue, modify |
I noticed that with some configuration of Connection Pool the Node process can't stop working and just hang.
In my case, it appears in mocha tests when mocha process can't finish after all tests.
This is simple project to reproduce the situation:
package.json
/test/test.js
Steps to reproduce:
npm test
.Actual behaviour: node process (i.e. mocha) is hang and can't finish.
Expected behaviour: node process (i.e. mocha) should finish correctly.
Note 1: Actually, I think this is very important issue because it may affect not only mocha process but also some processes in Docker environment and Lambda where processes should quickly start and finish to satisfy auto-scalabity algorithms.
Note 2: According to source code of mysql2, I noticed that in case of maxIdle < connectionLimit, mysql2 call
clearTimeout
. But looks like, it was forgotten to callclearTimeout
on pool.end(). That's why 'event loop' is not empty, and it prevents a process from finishing.The text was updated successfully, but these errors were encountered: