mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
A free socket with an idle timeout is normally destroyed by its timer. When the event loop is blocked long enough for that timeout to expire, the timer cannot run, and `addRequest()` can reuse the socket even though the server may already have closed the connection. This can cause the request to fail with `ECONNRESET`. Record when a socket enters the free pool and, before reuse, remove and destroy a free socket whose idle timeout has expired according to the timers' clock. Refs: https://github.com/nodejs/node/issues/54293 Assisted-by: a closed-source coding agent Signed-off-by: dennev <dennev13@gmail.com> PR-URL: https://github.com/nodejs/node/pull/67292 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>