Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fully fixes the FD leak by discarding the
response
stream usingresume()
We already discard the result of any GET or POST here, and always have (which we know from the types returning only a status code), so
resume()
is fine here.I was under the impression that since we did not provide
response.on('data', cb)
that this clause wouldn't apply and the response stream would be ignored:but of course passing a callback function counts as a
handler
so in this case the must clause counts and the underlying readable stream was never consumed, causing the FD leak.This code has been present for many years but only became an issue in Node20. For that, I'm not exactly clear. But I can confirm this PR fixes the issue.
Motivation
You can see the fix in this notebook
Testing Guidelines
Additional Notes
Types of Changes
Check all that apply