Error sending response to client. Ending connection from remote

Can anyone please explain this error log, it is coming around 400 times in 8 hours in the cluster node’s log,

{
  "t": {
    "$date": "2024-01-10T09:37:04.795+00:00"
  },
  "s": "I",
  "c": "NETWORK",
  "id": 22989,
  "ctx": "conn8073",
  "msg": "Error sending response to client. Ending connection from remote",
  "attr": {
    "error": {
      "code": 6,
      "codeName": "HostUnreachable",
      "errmsg": "Connection reset by peer"
    },
    "remote": "13.235.***.**:40902",
    "connectionId": 8073
  }
}

Hello, welcome to the MongoDB community!

The error in question appears to be a failed connection between the client and the database. And the message “Connection reset by peer” says that the remote application/entity abruptly terminated the connection.

Are you using which driver and which version? Can you see anything in the application log?

1 Like

The client is closing the connection before the response to the query/command is sent.

One cause can be if connect or socket timeouts have been set or set too low by the client. If they have been set, try without them.

Another can be related to needing lower tcp keepalive values, some intermediary network components may detect these as idle connection and close them.
https://www.mongodb.com/docs/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments-
https://www.mongodb.com/docs/manual/administration/production-checklist-operations/#deployments-to-cloud-hardware

1 Like