-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
async_hooks: don't reuse resource in HttpAgent when queued #34439
async_hooks: don't reuse resource in HttpAgent when queued #34439
Conversation
7d9619c
to
ed432dc
Compare
Pushed an additional test to verify |
@nodejs/async_hooks I'd appreciate some reviews here. 🙏🏻 |
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 - do we have a benchmark for this? It should not impact too much but still.
ed432dc
to
de40cba
Compare
I've checked existing benchmarks and the |
Here is the
|
I've done another run of the benchmark and this time it gave slightly different results: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/650 Looks like the benchmark involves a lot of jitter, yet it makes me thinking that there is no significant performance degradation introduced by this fix. After all, |
@Flarna no problem at all. Thanks for the update! |
de40cba
to
5548f89
Compare
5548f89
to
2212e09
Compare
@Flarna I've noticed one more place where we might loose async context. I'm talking about
So, I wonder if I should wrap |
@puzpuzpuz I'm not that deep into the HttpAgent flow. Maybe start by creating a test which reproduces the problem you think you found. If you fail it's maybe a code path which can't happen. |
@Flarna yeah, I see. Then I'm going to double check the path and try to reproduce it with a test. Going to update this PR, if necessary, and notify the reviewers. |
Update. I've checked the code path and we should be ok with the fix, as the Going to re-run CI tests and land the fix. |
Landed in 019ea07 |
@vdeturckheim @Flarna many thanks for your reviews! |
Blocked on #32801 |
Fixes: #34401
Refs: #27581
Checklist
This PR is a continuation of the
http.Agent
async resource reuse fix started in #27581. It deals with the case when a socket is not available immediately and, thus, the request is pushed into agent's queue.make -j4 test
(UNIX), orvcbuild test
(Windows) passes