Skip to content
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

Pool option "enableKeepAlive" is ignored? #1229

Open
davidecaroselli opened this issue Oct 15, 2020 · 2 comments
Open

Pool option "enableKeepAlive" is ignored? #1229

davidecaroselli opened this issue Oct 15, 2020 · 2 comments

Comments

@davidecaroselli
Copy link

Hi all!

I was experiencing several issues with Pool in production due to read ECONNRESET error and I finally found the response in this Github Issue: #683 (and, by the way, thanks to all for the amazing work done and the patience in debugging it! ;) )

So, I have updated from 2.0.1 to 2.2.5 (latest right now), but I found something strange. Looking at the code it seems that the new PoolConfig property enableKeepAlive is never actually queried.
I found this piece of code that I think should read this property:

this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);

But as you can see the function is always called with a hardcoded true.
Now, this is fine with me, because I was about to enable it anyway, but my question is: is this intentional? Am I missing some obvious bit of code?

Thanks!

@sidorares
Copy link
Owner

hm, looks like this is side effect of #1086 . see #1081 (comment) for reasons why it was added but to me looks like it should be moved inside if (this.config.enableKeepAlive) {} block

@kn3ny
Copy link

kn3ny commented Dec 6, 2020

I have the same doubt as @davidecaroselli during I was reading the code.
I believe the pull request #1258 will fix this issue.

vlasky added a commit to vlasky/node-mysql2 that referenced this issue Apr 30, 2021
…keepalive on the network connection. If not set, it defaults to false.

Resolves issue sidorares#1229 - Pool option "enableKeepAlive" is ignored?

sidorares#1229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants