Skip to content

Commit cc8d542

Browse files
bnoordhuisdanielleadams
authored andcommitted
deps: cherry-pick libuv/libuv@abb109f
Original commit log follows: darwin: remove EPROTOTYPE error workaround (libuv/libuv#3405) It's been reported in the past that OS X 10.10, because of a race condition in the XNU kernel, sometimes returns a transient EPROTOTYPE error when trying to write to a socket. Libuv handles that by retrying the operation until it succeeds or fails with a different error. Recently it's been reported that current versions of the operating system formerly known as OS X fail permanently with EPROTOTYPE under certain conditions, resulting in an infinite loop. Because Apple isn't exactly forthcoming with bug fixes or even details, I'm opting to simply remove the workaround and have the error bubble up. Refs: libuv/libuv#482 Fixes: #43916 PR-URL: #43950 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 29bcd47 commit cc8d542

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

deps/uv/src/unix/stream.c

+3-17
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,6 @@ struct uv__stream_select_s {
5858
fd_set* swrite;
5959
size_t swrite_sz;
6060
};
61-
62-
/* Due to a possible kernel bug at least in OS X 10.10 "Yosemite",
63-
* EPROTOTYPE can be returned while trying to write to a socket that is
64-
* shutting down. If we retry the write, we should get the expected EPIPE
65-
* instead.
66-
*/
67-
# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR || errno == EPROTOTYPE)
68-
# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \
69-
(errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS || \
70-
(errno == EMSGSIZE && send_handle != NULL))
71-
#else
72-
# define RETRY_ON_WRITE_ERROR(errno) (errno == EINTR)
73-
# define IS_TRANSIENT_WRITE_ERROR(errno, send_handle) \
74-
(errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
7561
#endif /* defined(__APPLE__) */
7662

7763
static void uv__stream_connect(uv_stream_t*);
@@ -866,17 +852,17 @@ static int uv__try_write(uv_stream_t* stream,
866852

867853
do
868854
n = sendmsg(uv__stream_fd(stream), &msg, 0);
869-
while (n == -1 && RETRY_ON_WRITE_ERROR(errno));
855+
while (n == -1 && errno == EINTR);
870856
} else {
871857
do
872858
n = uv__writev(uv__stream_fd(stream), iov, iovcnt);
873-
while (n == -1 && RETRY_ON_WRITE_ERROR(errno));
859+
while (n == -1 && errno == EINTR);
874860
}
875861

876862
if (n >= 0)
877863
return n;
878864

879-
if (IS_TRANSIENT_WRITE_ERROR(errno, send_handle))
865+
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
880866
return UV_EAGAIN;
881867

882868
return UV__ERR(errno);

0 commit comments

Comments
 (0)