diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2022-07-22 22:02:58 +0200 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2022-07-25 09:47:59 +0000 |
commit | ceb8f9c6eb9aeb515f112e9ba2115057b6ccea62 (patch) | |
tree | 77fc8fac56d843d37a6cc5dbd7b74694bbc65559 /deps | |
parent | 7287f44cdc9314236c888a4b18e6f697441ae4d4 (diff) | |
download | node-new-ceb8f9c6eb9aeb515f112e9ba2115057b6ccea62.tar.gz |
deps: cherry-pick libuv/libuv@3a7b955
Original commit log follows:
darwin: translate EPROTOTYPE to ECONNRESET (libuv/libuv#3413)
macOS versions 10.10 and 10.15 - and presumbaly 10.11 to 10.14, too -
have a bug where a race condition causes the kernel to return EPROTOTYPE
because the socket isn't fully constructed.
It's probably the result of the peer closing the connection and that is
why libuv translates it to ECONNRESET.
Previously, libuv retried until the EPROTOTYPE error went away but some
VPN software causes the same behavior except the error is permanent, not
transient, turning the retry mechanism into an infinite loop.
Refs: https://github.com/libuv/libuv/pull/482
Refs: https://github.com/libuv/libuv/pull/3405
Fixes: https://github.com/nodejs/node/issues/43916
PR-URL: https://github.com/nodejs/node/pull/43950
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r-- | deps/uv/src/unix/stream.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index c5cd6ddc0b..b5b05a6a4a 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -865,6 +865,20 @@ static int uv__try_write(uv_stream_t* stream, if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) return UV_EAGAIN; +#ifdef __APPLE__ + /* macOS versions 10.10 and 10.15 - and presumbaly 10.11 to 10.14, too - + * have a bug where a race condition causes the kernel to return EPROTOTYPE + * because the socket isn't fully constructed. It's probably the result of + * the peer closing the connection and that is why libuv translates it to + * ECONNRESET. Previously, libuv retried until the EPROTOTYPE error went + * away but some VPN software causes the same behavior except the error is + * permanent, not transient, turning the retry mechanism into an infinite + * loop. See https://github.com/libuv/libuv/pull/482. + */ + if (errno == EPROTOTYPE) + return UV_ECONNRESET; +#endif /* __APPLE__ */ + return UV__ERR(errno); } |