Due to implementation of SO_ERROR on Aix and ibmi, as soon as remote sends RST packet, socket fd corresponding to an opened connection immediately enters an error state with SO_ERROR=73 (ECONNRESET), and getsockname() returns EINVAL while there are still readable bytes on the fd. Subsequent read() operation would succeed despite the error state of the fd.
In such case peerfd may sometimes enter error state shortly after being accepted by uv__accept() without any additional action being performed on the fd by libuv. On Aix and IBMi, this sometimes causes uv_pipe_pending_type() to return UV_UNKNOWN_HANDLE due to getsockname() failing, which in many cases causes the listening server to stop replying to
new incoming connections.
When used in node.js, the consequence of this is that a simple http server application can receive a RST packet and "hang", not processing and replying to fresh incoming connections.
Due to implementation of
SO_ERROR
on Aix and ibmi, as soon as remote sends RST packet, socket fd corresponding to an opened connection immediately enters an error state withSO_ERROR=73
(ECONNRESET), andgetsockname()
returns EINVAL while there are still readable bytes on the fd. Subsequentread()
operation would succeed despite the error state of the fd.In such case peerfd may sometimes enter error state shortly after being accepted by
uv__accept()
without any additional action being performed on the fd by libuv. On Aix and IBMi, this sometimes causesuv_pipe_pending_type()
to return UV_UNKNOWN_HANDLE due togetsockname()
failing, which in many cases causes the listening server to stop replying to new incoming connections.When used in node.js, the consequence of this is that a simple http server application can receive a RST packet and "hang", not processing and replying to fresh incoming connections.
Issue was first observed in Node when using Nessus scanner with a simple server application that uses cluster: https://github.com/nodejs/node/issues/40724.
On Aix, IBMi the use of cluster appears to increase the frequency with which application can "hang".
Proposed fix: https://github.com/libuv/libuv/pull/3482