Description
When sending a bulk request that is larger than Elasticsearch is configured to accept, it will respond with a 413 Content Too Large
and close the connection. When the client uses HttpConnection
as its connection type and ClusterConnectionPool
as its pool type, it does not appropriately handle when the connection is closed by the server. That socket will stay in the pool and may be used by a subsequent request, raising a read ECONNRESET
or EPIPE
exception when trying to send a request over a closed connection.
It has not yet been verified whether the same happens when using UndiciConnection
or other pool types, so all combinations may need to be tested.
From @rudolf while reporting on this issue:
I suspect we at some point try to close the already closed socket.