report: add fallback for uv_getnameinfo() failures#26140
report: add fallback for uv_getnameinfo() failures#26140richardlau wants to merge 3 commits intonodejs:masterfrom
Conversation
|
Failue on ubuntu1804 is also seen in the CI for the standalone module when run through CITGM: nodejs/node-report#120 (comment) |
|
Windows failures are due to the filename being prefixed with |
|
Sticking a WIP label on for the moment while I fix the test for Windows. The ubuntu1804 also needs investigating. |
|
Re. ubuntu1804 failures. I've stuck some temporary debug code and get this on the CI: So
|
Attempt to report the host and port in the case that uv_getnameinfo() fails.
06936cd to
b49fc72
Compare
|
I've reworked the endpoint reporting by factoring out to another function and adding a fallback for the case that |
Outdated - Changes to src/node_report_utils.cc are now different.
|
Resume CI: https://ci.nodejs.org/job/node-test-pull-request/20890/ (✔️) |
Ports fixes from core: nodejs/node#25962 nodejs/node#26140 Fixes: nodejs#120
|
I've also ported this over to the standalone module (nodejs/node-report#123) to fix CITGM failures seen on ubuntu1804 on our CI (nodejs/node-report#120). |
src/node_report_utils.cc
Outdated
| if (uv_inet_ntop(family, addr, host, sizeof(host)) == 0) { | ||
| std::string port = std::to_string(ntohs(family == AF_INET ? | ||
| reinterpret_cast<sockaddr_in*>(addr)->sin_port : | ||
| reinterpret_cast<sockaddr_in6*>(addr)->sin6_port)); |
There was a problem hiding this comment.
Does it make sense to represent the port as an integer? That would allow skipping the stringifying step, but I imagine we’d also need to do that in the uv_getnameinfo() case?
There was a problem hiding this comment.
Yes, it probably does make sense to be an integer. I've stringified it here for consistency with the existing uv_getnameinfo() case.
There was a problem hiding this comment.
If you just assign the host and port in the conditionals, then you can DRY the writer code a bit.
cjihrig
left a comment
There was a problem hiding this comment.
LGTM with a couple suggestions.
src/node_report_utils.cc
Outdated
| wrote_local_endpoint = true; | ||
| } | ||
| if (rc != 0 || !ReportEndpoint(h, addr, "localEndpoint", writer)) { | ||
| writer->json_keyvalue("localEndpoint", null); |
There was a problem hiding this comment.
Could you move this into ReportEndpoint()? Then, this logic could just be:
if (rc != 0)
ReportEndpoint(h, addr, "localEndpoint", writer);Same for the remote endpoint code below.
src/node_report_utils.cc
Outdated
| if (uv_inet_ntop(family, addr, host, sizeof(host)) == 0) { | ||
| std::string port = std::to_string(ntohs(family == AF_INET ? | ||
| reinterpret_cast<sockaddr_in*>(addr)->sin_port : | ||
| reinterpret_cast<sockaddr_in6*>(addr)->sin6_port)); |
There was a problem hiding this comment.
If you just assign the host and port in the conditionals, then you can DRY the writer code a bit.
|
Refactored |
| } | ||
| writer->json_objectstart(name); | ||
| if (host != nullptr) { | ||
| writer->json_keyvalue("host", host); |
There was a problem hiding this comment.
I believe it's extremely unlikely for host to be nullptr (both uv_getnameinfo() and uv_inet_ntop() would have to fail) here but in the case that it is I've opted to omit the host key. Let me know if you'd prefer to emit host: null instead (i.e. the host key is always written), or something else (host: '<unable to determine>'?).
|
AIX failure is infra (disk space issues): nodejs/build#1708 Resume CI: https://ci.nodejs.org/job/node-test-pull-request/21036/ (✔️ ) |
|
Landed in fc4c0de |
Attempt to report the host and port in the case that uv_getnameinfo() fails. PR-URL: #26140 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Attempt to report the host and port in the case that uv_getnameinfo() fails. PR-URL: #26140 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Ports fixes from core: nodejs/node#25962 nodejs/node#26140 PR-URL: nodejs#123 Fixes: nodejs#120 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Ports fixes from core: nodejs/node#25962 nodejs/node#26140 PR-URL: #123 Fixes: #120 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
I started on the test changes first (to test the information reported in the libuv section) and uncovered this bug (the parsed object had
nullfor allremoteEndpointkeys).Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes