Skip to content

test: fix flaky test-net-error-twice

On Windows there can exist some race condition where the OS notification of the client's socket.destroy() isn't received before the server writes to the socket, so the OS happily writes to the server socket and the socket.destroy() notification is seen as an EOF. This race condition was more evident/reproducible on a single core system (for obvious reasons in hindsight).

This commit fixes the flakiness by waiting until the server's connection event handler has been called to destroy the client socket and perform the server socket write.

Fixes: https://github.com/nodejs/node/issues/4057

Merge request reports

Loading