node-mysql2
node-mysql2 copied to clipboard
"read ETIMEDOUT" issues
We've been seeing sporadic read ETIMEDOUT errors when making queries to our database. The traffic is fairly low, and the issue is seen in periods of very low activity i.e. overnight.
These are the particulars:
- Node
22.14.0 - Relevant npm dependencies
mysql2-^3.12.0typeorm-^0.3.20@nestjs/typeorm-^10.0.2
- MySQL 8.0.40 on AWS RDS
- Instance class
db.t4g.large - No RDS proxy
- Instance class
All are on pretty standard config. We've tried setting some of these options but no success
connectTimeout: 30_000
connectionLimit: 40
maxIdle: 10
idleTimeout: 30_000
Are there any configuration options worth trying? AWS seems to suggest there are no issues on their end, very stumped!
Hi, I have seen something similar when using RDS mysql with IAM and a rarely used app. When I access the app after a longer period of time it attempts to create new connections but fails since the AWS token expires after 15 minutes.
I have this in my app pool setup but it does not seem to actually be keeping the connections alive:
connectionLimit: 2
enableKeepAlive: true,
keepAliveInitialDelay: 60000,
The amount of time until the issue occurs seems directly related to the MySQL wait_timeout setting so I think its an issue with enableKeepAlive not working.
Using :
- Node
v23.6.0 - mysql2:
^3.11.3
and the same RDS MySQL setup as above
same issues here. here is my settings:
waitForConnections: true,
connectionLimit: 30,
maxIdle: 10,
idleTimeout: 60000,
queueLimit: 0,
enableKeepAlive: true,
keepAliveInitialDelay: 0,
the client lost connection to the database. but can resume after restart the client.
Using:
- "mysql2": "^3.11.5"