How do I resolve the "Got an error reading communication packets" error in Amazon RDS MySQL?

Last updated: 2021-08-06

I received a "Got an error reading communication packets" error in Amazon RDS MySQL. How do I resolve this error?

Short description

If server-client connections are dropped, improperly closed, or are unsuccessful, Amazon Relational Database Service (Amazon RDS) MySQL increments the status counter for either aborted_clients or aborted_connects.

If log_error_verbosity exceeds a value of 2, then RDS MySQL will write the following information to your error log:

[Warning] Aborted connection xxx to db: '<database name>' user: '<user name>' host: '<host IP>' (Got an error reading communication packets)

This warning is triggered whenever the status counter for the aborted_clients or aborted_connects metric values are incremented. Amazon RDS uses the database error logs to retrieve this information. For more information, see Communication errors and aborted connections on the MySQL server website.

Factors that can trigger the Aborted connection warning include (but aren't limited to) the following:

  • Client or driver incompatibility
  • Firewalls or proxies, which can close any idle connections or block a connection.
  • Improper closing of a client-server connection, resulting in a higher number of sleeping connections inside Amazon RDS MySQL.
  • Idle connections that exceed the wait_timeout or interactive_timeout thresholds.
  • A client application that improperly terminates a connection.
  • A client connection that exceeds the connect_timeout seconds threshold when obtaining a connection packet.
  • The max_allowed_packet parameter value is exceeded. If queries require more memory than what the instance has allocated for Amazon RDS MySQL, then the Aborted connection warning will get triggered.


If you receive an Aborted connection error in Amazon RDS for MySQL, then make sure to review your MySQL parameter values. After you identify the root cause of your issue, update the parameter and test the new value, while monitoring the MySQL error logs.

As you troubleshoot the Aborted Connection error in Amazon RDS, consider the following approaches:

  • Check to see if you're using the default values of an Amazon RDS parameter group. The default values for parameters related to connectivity timeouts might not be appropriate for your DB instance. For more information about these parameters, see the Parameters related to connectivity timeout section of Best practices for configuring parameters for Amazon RDS for MySQL.
  • Set a higher value for connect_timeout to see if this helps to reduce the occurrence of the Aborted connection error messages. This parameter specifies how long the MySQL server instance must wait (in seconds) before responding with a bad handshake.
  • Modify interactive_timeout and wait_timeout. Applications that use connection pooling (such as Java) must have timeouts that match the connection pool settings.
  • Increase the value of max_allowed_packet if the instance must handle big queries. If a row has more data than the max_allowed_packet value for the client, then errors are reported. Increase this value if you are using large BLOB columns or long strings. For more information, see the max_allowed_packet section of Best practices for configuring parameters for Amazon RDS for MySQL.
  • Make sure that the Amazon RDS for MySQL connections are properly closed. Before exiting the database, make sure to call the mysql_close() function from the client application.

Troubleshooting tips

If you're still receiving the Aborted connection error message, try the following troubleshooting tips:

  • Enable Performance Insights to retrieve the timeframe of the SQL statements that are causing the warning.
  • Execute the tcpdump command from the machine that's running the client to test sample packet captures. For example:
sudo tcpdump -vvv --interface eth0 port 3306 -W 10 -C 100

Did this article help?

Do you need billing or technical support?