-
-
Save isaacs/2140458 to your computer and use it in GitHub Desktop.
From e0aeb95dbf91c6dff27f88ac22910d2c0278a255 Mon Sep 17 00:00:00 2001 | |
From: Robert Mustacchi <rm@joyent.com> | |
Date: Tue, 20 Mar 2012 12:40:48 -0700 | |
Subject: [PATCH] Need to handle ECONNABORTED. | |
--- | |
src/unix/stream.c | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/src/unix/stream.c b/src/unix/stream.c | |
index 111bbc2..08d1971 100644 | |
--- a/src/unix/stream.c | |
+++ b/src/unix/stream.c | |
@@ -176,7 +176,7 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) { | |
fd = uv__accept(stream->fd, (struct sockaddr*)&addr, sizeof addr); | |
if (fd < 0) { | |
- if (errno == EAGAIN) { | |
+ if (errno == EAGAIN || errno == ECONNABORTED) { | |
/* No problem. */ | |
return; | |
} else if (errno == EMFILE) { | |
-- | |
1.7.3.3 |
@bnoordhuis That lgtm. AFAICT, should ignore the econnaborted just as surely, but without missing any other connections.
@bnoordhuis: On Windows read() reports ECONNABORTED sometimes. We turn this into ECONNRESET to be consistent with linux. Does uv-unix need something similar for BSDs?
On Windows read() reports ECONNABORTED sometimes. We turn this into ECONNRESET to be consistent with linux. Does uv-unix need something similar for BSDs?
Well, maybe. Simply ignoring ECONNABORTED seems easier though, both for us and libuv users.
Well, I'm talking about read returning ECONNABORTED. We have to make the callback, because otherwise the user would leak uv_buf_t
s.
Oh, hah - yeah, I was still talking about accept()
.
Ok so let me repeat the question. On Windows read() reports ECONNABORTED sometimes. We turn this into ECONNRESET to be consistent with linux. Does uv-unix need something similar for BSDs?
I don't think we need to do anything with read(). The important thing is that we get this accept() bug fixed. It's causing injuries currently.
According to @rmustacc, it's not possible for read(2) to return that on sunos. I don't see any mention of it in the BSD man pages, either. Let's just make the change for accept only.
it's not possible for read(2) to return that on sunos
Same on Linux. It makes sense when you think about it. I landed a patch in joyent/libuv@c9c9d80.
That patch doesn't look right. If there are 2 pending connections and the first one fails with ECONNABORTED, then a) the second one won't get accepted and b) the event loop will probably stall if it's edge-triggered. I suggest this instead:
cc @rmustacc