- Le plus récent
- Le plus de votes
- La plupart des commentaires
Error traceback : 'Lost connection to MySQL server during query ([Errno 54] Connection reset by peer)'
Peer connection resets are sudden break in connections from the server (peer). Connection Resets could occur due to a number of reasons with problems originating either at the client application, DB server (RDS instance) or the network connectivity between them.
From the description provided, since the application throws the error after an idle time (2-3 minutes). It is likely the application is not gracefully terminating the older connection while one of the following scenarios being true:
- The MySQL timeout parameters of the RDS database is set lower than the Client connection timeout making RDS to terminate/reset the connection.
Timeout parameters in RDS MySQL - https://aws.amazon.com/blogs/database/best-practices-for-configuring-parameters-for-amazon-rds-for-mysql-part-3-parameters-related-to-security-operational-manageability-and-connectivity-timeout/
- The ‘max_allowed_packet’ parameter of your RDS database value is too small or queries require more memory than you have allocated for mysqld. You must increase this value if you are using large BLOB columns or long strings.
max_allowed_packet parameter - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
- Your network firewall, intermediatory proxy (RDS Proxy - IdleClientTimeout) or network load balancers (AWS ELB – IdleTimeout) has a timeout established that terminate “idle” TCP connections when there is no activity on them for a certain period of time.
IdleClientTimeout in RDS Proxy - https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-managing.html#rds-proxy-connection-pooling-tuning.idleclienttimeout
IdleTimeout in AWS EBS - https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html
If the issue is DB induced, you may find more information in the RDS Error logs. Connection reset may also happen due to abrupt unavailability of the DB instance or an RDS network incident. You can check the NetworkTransmitThroughput and NetworkReceiveThroughput CloudWatch metrics for a sudden drop indicative of RDS network problems, and check RDS Events and Error logs indicative of a database reboot or crash.
However, based on the the described pattern of error occurrence, it appears the problem is either at the Intermediatory Network (firewall, proxy or load balancer) or at the Application level.
Contenus pertinents
- demandé il y a 3 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans