How do I troubleshoot the error "could not send data to client" or "could not receive data from client" when connecting to my Amazon RDS PostgreSQL or Aurora PostgreSQL DB instance?

Last updated: 2021-05-04

I tried to query my Amazon Relational Database Service (Amazon RDS) PostgreSQL or Amazon Aurora PostgreSQL-Compatible Edition DB instance. But when I did so, I received one of the following errors:

  • "could not send data to client"
  • "could not receive data from client"

Short description

If a backend process in an Amazon RDS DB instance can't send or receive from a client, then the backend process records one of the following errors in the PostgreSQL log:

  • "could not send data to client"
  • "could not receive data from client"

Resolution

These errors can occur because of many reasons. Review the steps below to troubleshoot this issue.

Check aliveness of the client

Check the aliveness of the client process first. If the client process crashed because of OOM, for example, then the session might be terminated incorrectly. This termination can cause either of these errors to occur.

Shorten tcp_keepalives_idle and tcp_keepalives_interval parameters

If the processing time of a query is too long, then the session might be terminated incorrectly from the client. To resolve this issue, increase the client's timeout setting. You can also shorten the tcp_keepalives_idle and tcp_keepalives_interval parameters to check aliveness of the client from the backend process. For more information, see Modifying parameters in a DB parameter group.

To check the default values of tcp_keepalives_idle and tcp_keepalives_interval, run the following command using a PostgreSQL client such as psql:

SELECT name, setting FROM pg_settings WHERE name LIKE 'tcp_keepalives_%'

Check connectivity

If the error occurs irrespective of less query processing times, check the connectivity between the client and the DB instance.

After failover from rdsadmin session

If the error occurs after failover from an rdsadmin session, you can ignore the error.


PostgreSQL documentation for PostgreSQL error codes

PostgreSQL documentation for Connections and authentication

Setting TCP keepalives parameters

Did this article help?


Do you need billing or technical support?