-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
report: fix network queries in getReport libuv with exclude-network #55602
base: main
Are you sure you want to change the base?
Conversation
Hi! Could you amend your commit to have a valid subsystem? In this case, |
9d44c7f
to
dd14b0e
Compare
it('should not do DNS queries in libuv if exclude network', async () => { | ||
await fetch('http://127.0.0.1'); | ||
|
||
process.report.excludeNetwork = false; | ||
let report = process.report.getReport(); | ||
let tcp = report.libuv.find((uv) => uv.type === 'tcp'); | ||
assert.notEqual(tcp, null); | ||
assert.strictEqual(tcp.localEndpoint.host, 'localhost'); | ||
assert.strictEqual(tcp.remoteEndpoint.host, 'localhost'); | ||
|
||
process.report.excludeNetwork = true; | ||
report = process.report.getReport(); | ||
tcp = report.libuv.find((uv) => uv.type === 'tcp'); | ||
assert.notEqual(tcp, null); | ||
assert.strictEqual(tcp.localEndpoint.host, '127.0.0.1'); | ||
assert.strictEqual(tcp.remoteEndpoint.host, '127.0.0.1'); | ||
}); |
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.
Does this have to go in test/internet
?
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.
Good question, it's still a test for getReport and the request is self contained to localhost, so does it make sense in internet?
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 don't know where it belongs, we'll see if someone else mentions it.
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 don't think this feature access the "internet". It just accesses local network information.
This should be backported to node 20 and node 22 as well |
As long as it's not a semver-major change, which it's not at this point in time, it'll be planned to be backported. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55602 +/- ##
==========================================
- Coverage 88.44% 88.41% -0.03%
==========================================
Files 654 654
Lines 187751 187761 +10
Branches 36146 36122 -24
==========================================
- Hits 166050 166015 -35
- Misses 14942 14994 +52
+ Partials 6759 6752 -7
|
a00c190
to
78b4dfc
Compare
4373985
to
f596a70
Compare
…e it runs and skip ipv6 if not supported
Failed to start CI⚠ No approving reviews found ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/11619348784 |
Fixes #55576 #46060
I also added in the endpoint's report info the keys
ip4
orip6
which contain the ip address of the endpoint (as well as information on which stack it was via the key)Example of a tcp uv with network (default) (note that the reverse hostname resolving is up to the system dns resolver and some implementation may not resolve 127.0.0.1 to localhost for example on one of the ci server it resolves to
test-ibm-rhel9-x64-1.nodejs.cloud
)Example of a tcp uv without network
The only difference between the two is that a reverse lookup is not performed on the host and will always contain the ip address without network (this is already the fallback if the reverse lookup fails, so that the change is almost invisible)
It would be nice if eventually getReport could be made to accept options instead of the very weird api with assignements and be made async instead and uv_getnameinfo made in async as well, but that's way too big a task for me to take on (I already barely stitched that PR together with my C++ knowledge which is non existant, I only know C)