-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: handle EUNATCH #48050
test: handle EUNATCH #48050
Conversation
29a4028
to
6ec3fe0
Compare
6ec3fe0
to
7b86dc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bandaid and I believe you're aware of that. The right way to fix it is to make libuv handle it.
I can't test it but the change would look something like this:
diff --git a/src/unix/stream.c b/src/unix/stream.c
index 03f92b50..1d01eac5 100644
--- a/src/unix/stream.c
+++ b/src/unix/stream.c
@@ -60,6 +60,10 @@ struct uv__stream_select_s {
};
#endif /* defined(__APPLE__) */
+#ifndef EUNATCH
+#define EUNATCH 0
+#undef
+
union uv__cmsg {
struct cmsghdr hdr;
/* This cannot be larger because of the IBMi PASE limitation that
@@ -1267,6 +1271,11 @@ static void uv__stream_connect(uv_stream_t* stream) {
if (error == UV__ERR(EINPROGRESS))
return;
+ /* Work around ibmi quirk. */
+ if (EUNATCH)
+ if (error == UV__ERR(EUNATCH))
+ error = UV__ERR(ECONNREFUSED);
+
stream->connect_req = NULL;
uv__req_unregister(stream->loop, req);
I agree the right way is to make libuv handle it.
|
I've landed a PR to add |
When IPv6 is disabled IBM i returns EUNATCH (errno 42) instead of EADDRNOTAVAIL. libuv 1.46.0 adds EUNATCH errno We can now use error.code to refer to EUNATCH in node versions that use libuv 1.46.0.
7b86dc9
to
09207b8
Compare
@bnoordhuis @mhdawson @richardlau We can now use error.code to refer to EUNATCH I've updated the checks to look for CC @nodejs/platform-ibmi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ping @bnoordhuis Can you please re-review the latest changes? |
This PR was updated after libuv was updated to 1.46.0. @bnoordhuis does your objection still stand? |
@bnoordhuis not sure if you are away, but I think your concerns/comments have been addressed and this is ready to land. If we don't hear back from you by the end of the week I'll assume it's ok to remove your block and proceed. |
I'm indeed away. "Gone rock climbing" is intended quite literally but of course I'll take a break from on-siting 7a's for Node.js. So, I don't believe it's necessary to merge this PR as libuv should be handling it transparently now. Is that not the case? |
Hey @bnoordhuis 👋🏿 This is PR is still needed as libuv now has support for the The libuv changes: We are not remapping EUNATCH -> ECONNREFUSED. Before we had test cases simply checking the raw errno e.g. assert.strictEqual(error.errno, -42); Now we addresses the issue by checking the error code e.g. error.code === 'EUNATCH' This PR adds checks for We have a failing test case on the IBM i CI that is waiting on the changes from this PR: |
I've dismissed my review because shrug but I wonder why you didn't opt to handle this inside libuv. I assume IBM wants porting to its platforms to be as frictionless as possible. |
Yes, but it's a hard balance sometimes. EUNATCH represents something different from ECONNREFUSED (or any other errno), and some software behaves appropriately differently when EUNATCH is surfaced. In this particular case, differentiation of behavior is not needed, but I don't think we want to mask EUNATCH in libuv |
ECONNREFUSED is not the correct errno to compare with, since that's used in the case that IPv6 is enabled. The real comparison is with EAFNOSUPPORT and EADDRNOTAVAIL. If we wanted to remap this for "consistency" then, which should we choose? POSIX errnos are already kind of a mess of inconsistencies and libuv returning it directly basically pushes that on to the consumer. I'm not sure why we should remap EUNATACH for this one case when libuv doesn't do that for EAFNOSUPPORT or EADDRNOTAVAIL already (and likely in other circumstances). |
} else if (error.code === 'EADDRNOTAVAIL' || error.code === 'EUNATCH') { | ||
assert.strictEqual(error.message, `connect ${error.code} ::1:${port} - Local (:::0)`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match existing code behavior. Should add a separate else if leg like the EAFNOSUPPORT above.
} else if (error.code === 'EADDRNOTAVAIL' || error.code === 'EUNATCH') { | |
assert.strictEqual(error.message, `connect ${error.code} ::1:${port} - Local (:::0)`); | |
} else if (error.code === 'EUNATCH') { | |
assert.strictEqual(error.message, `connect EUNATCH ::1:${port} - Local (:::0)`); | |
} else { | |
assert.strictEqual(error.code, 'EADDRNOTAVAIL'); | |
assert.strictEqual(error.message, `connect EADDRNOTAVAIL ::1:${port} - Local (:::0)`); |
Either that or merge the EAFNOSUPPORT else block in to this one. The other tests have this same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the option of adding a separate else leg. Will fix this up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added else if legs for EUNATCH in f83b102
My point wasn't that ECONNREFUSED is the best error to report, I just picked it as an example. EUNATACH is an exotic error (not widely available and rare even on systems that report it) and therefore it's better to map it to something more mundane like EADDRNOTAVAIL. There's a decent chance a libuv user has logic for handling EADDRNOTAVAIL but EUNATACH? No way. |
When IPv6 is disabled IBM i returns EUNATCH (errno 42) instead of EADDRNOTAVAIL. libuv 1.46.0 adds EUNATCH errno We can now use error.code to refer to EUNATCH in node versions that use libuv 1.46.0. PR-URL: #48050 Refs: #48049 Refs: #46546 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Landed in ee1f609 |
When IPv6 is disabled IBM i returns EUNATCH (errno 42) instead of EADDRNOTAVAIL. libuv 1.46.0 adds EUNATCH errno We can now use error.code to refer to EUNATCH in node versions that use libuv 1.46.0. PR-URL: #48050 Refs: #48049 Refs: #46546 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
When IPv6 is disabled IBM i returns EUNATCH (errno 42) instead of EADDRNOTAVAIL. libuv 1.46.0 adds EUNATCH errno We can now use error.code to refer to EUNATCH in node versions that use libuv 1.46.0. PR-URL: nodejs#48050 Refs: nodejs#48049 Refs: nodejs#46546 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Refs: #48049
Refs: #46546
When IPv6 is disabled IBM i returns EUNATCH (errno 42)
instead of EADDRNOTAVAIL.
libuv 1.46.0 adds EUNATCH errno
We can now use error.code to refer to EUNATCH
in node versions that use libuv 1.46.0.
CC @richardlau
CC @nodejs/platform-ibmi