-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
ECONNRESET Connection reset by peer (104) #1944
Comments
4 - yes, this is the behaviour I'd expect. The only explanation I have is that mysql closes one side of the connection due to timeout somewhere behind the proxy and this is not communicated back to the client ( for example proxy still responds to tcp keepalive heartbeat from mysql2 client ) PoolConnection is removed from pool on end / error events here: node-mysql2/lib/pool_connection.js Line 19 in 991160c
|
Worth investigating the following scenario:
Can you try to attach some logging to a connection end / error events and see if above scenario happens? |
@komanton I wonder if google's "cloud sql connector" would make any difference https://cloud.google.com/sql/docs/mysql/connect-connectors#node.js_1 Internally it creates it's own stream and manages it, and mysql connections live on top of that stream(s) |
For the part of retry, is there anyway take example, we catch it the econnreset and retry out function using mysql2 or we need to do it ourself in our own code? Thank you |
Thanks for your work. We are using the connection pool of mysql2 in production in CloudRun with "CPU is always allocated" (i.e. simply say, it is a regular nodejs app) with enabled TCP's
keepAlive
option.But from time to time (~2-5 errors during a minute almost every week), during invocation of
pool.query
, we receive the ECONNRESET Connection reset by peer (104) error.According to the documentation, this error maybe a result of 'infrastructure updates' .
My questions:
If your application reuses long-lived connections, then we recommend that you configure your application to re-establish connections to avoid the reuse of a dead connection.
pool.query()
?pool.query()
? Will the next call ofpool.query()
, after the error ECONNRESET(104), use a new connection?Connection pool configuration:
Error stack:
The text was updated successfully, but these errors were encountered: