-
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
net: defer self.destroy calls to nextTick #54857
base: main
Are you sure you want to change the base?
net: defer self.destroy calls to nextTick #54857
Conversation
Wrote tests for the suggested fix in nodejs#48771 (comment) Fixes: nodejs#48771
Review requested:
|
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54857 +/- ##
=======================================
Coverage 87.90% 87.91%
=======================================
Files 651 651
Lines 183343 183343
Branches 35710 35722 +12
=======================================
+ Hits 161165 161177 +12
+ Misses 15466 15441 -25
- Partials 6712 6725 +13
|
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.
nice. thank you and congrats on your first contribution!
This comment was marked as outdated.
This comment was marked as outdated.
Thank you, so excited to become a part of the family! @anonrig What are the next steps then? Do I have to do anything to initiate the merge? I see that my branch is behind a few commits, should I rebase and push again? |
Running the CI and getting it to pass. We'll take of running it, in case there are related failures it would up to you to fix them.
no need unless there are conflicts. |
Hey @mcollina , thanks for your reply! So the CI is currently failing. When I look up the details, I see two kinds of failures;
Stack trace shows that my tests timeout for some reason.
For this file, I have no idea why this is failing. Here's the stack trace;
There are other failing tests but their severity is I rebased my branch on top of the current |
That's a red flag, we don't want to merge flaky tests in our codebase. A timeout probably means there's a race condition somewhere that you forgot to take into account and result in the test never exiting. To try to reproduce the flakiness locally, you can try running: tools/test.py --repeat 9999 -t 2 test/parallel/test-http-client-immediate-error.js Once you have a repro, you can attempt getting a fix ready. |
Hey @aduh95 , thanks for the clarifying 🙏 Unfortunately the piece of code you suggested did not reproduce the problem for me. I'm on OSX, can you think of anything else that I can try? |
@mcollina FYI, this adds overhead to |
CI is failing |
Yep, it is @mcollina. Any suggestions on how to reproduce it? Any chance I can shell into the machine(or container) facing problems? Or, are there any snapshot/images I can pull into my machine and try to spin it up? In other words, what are the usual steps that you guys take when you face a problem in CI? |
In this specific case, it seems that any Linux box on top of any virtualization software would do. For more exotic systems @nodejs/build can provide access. |
Fixes: #48771
What is the problem being solved?
#48771 Reported
request
object returned fromhttp.request
method cannot catcherror
events triggered when there’s an immediate failure trying to connect to an address returned from dns lookup.Solution
#51038 implemented changes suggested in #48771 (comment). However the #51038 couldn’t be merged due to lack of tests(#51038 (review)). In this PR, I apply the same fix but with some tests.
Testing Considerations
All
process.nextTick(() => self.destroy())
are hit except one. Below is theself.destroy()
call that is not hit in these tests provided:node/lib/net.js
Line 1113 in 9404d3a
I am not tagging this PR as "DRAFT" since the piece of code that isn't tested is for a connection timeout case.
@mcollina Please let me know if these tests are sufficient or not.