| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
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);
Sorry, something went wrong.
|
I agree the right way is to make libuv handle it.
|
Sorry, something went wrong.
|
I've landed a PR to add EUNATCH support in libuv. |
Sorry, something went wrong.
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.
|
@bnoordhuis @mhdawson @richardlau We can now use error.code to refer to EUNATCH I've updated the checks to look for EADDRNOTAVAIL or EUNATCH CC @nodejs/platform-ibmi |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
Ping @bnoordhuis Can you please re-review the latest changes? |
Sorry, something went wrong.
|
This PR was updated after libuv was updated to 1.46.0. @bnoordhuis does your objection still stand? |
Sorry, something went wrong.
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
Hey @bnoordhuis 👋🏿 This is PR is still needed as libuv now has support for the EUNATCH errno. 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 EUNATCH error code in the spots its raised (when ipv6 is disabled). We have a failing test case on the IBM i CI that is waiting on the changes from this PR: |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
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 |
Sorry, something went wrong.
|
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). |
Sorry, something went wrong.
| } 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.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
I like the option of adding a separate else leg. Will fix this up!
Sorry, something went wrong.
There was a problem hiding this comment.
Added else if legs for EUNATCH in f83b102
Sorry, something went wrong.
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. |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
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: #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>
| Back | FazBrowse Home | New Git URL |
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