src: release context frame in AsyncWrap::EmitDestroy#61995
src: release context frame in AsyncWrap::EmitDestroy#61995Flarna wants to merge 3 commits intonodejs:mainfrom
Conversation
Release the async context frame in AsyncWrap::EmitDestroy to allow gc to collect it. This is in special relevant for reused resources like HTTPParser otherwise they might keep ALS stores alive.
391ae5a to
bdd2d38
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61995 +/- ##
==========================================
- Coverage 89.77% 89.73% -0.05%
==========================================
Files 674 676 +2
Lines 205705 206074 +369
Branches 39449 39514 +65
==========================================
+ Hits 184670 184918 +248
- Misses 13280 13311 +31
- Partials 7755 7845 +90
🚀 New features to boost your workflow:
|
src/async_wrap.cc
Outdated
| HandleScope handle_scope(env()->isolate()); | ||
| USE(object()->Set(env()->context(), env()->resource_symbol(), object())); | ||
| } | ||
| context_frame_.Reset(); |
There was a problem hiding this comment.
Not for this PR, but do you know how it comes this is a v8::Global to begin with and not an internal field on object()?
Co-authored-by: Anna Henningsen <github@addaleax.net>
There was a problem hiding this comment.
Sorry, just saw your comments on the DCHECK (hidden because of the resolved comment) – that's exactly why the DCHECK should be in place, we should not be able to MakeCallback() when there isn't a corresponding context frame to be entered.
I can try to find some time to dig into those failures.
|
Yeah, the only error I'm getting is this one: That's the test from #37958, which was added to complete coverage and intentionally uses internal APIs. We could skip the DCHECK for now, but it does catch a valid issue here I'd say. |
|
Setting The failing test shows actually a race in HTTP:
Adding But well, thats an unrelated issue for an http expert. Do you want me to remove the |
Release the async context frame in
AsyncWrap::EmitDestroyto allow gc to collect it.This is in special relevant for reused resources like
HTTPParserotherwise they might keep ALS stores alive.Fixes: #61882
Refs: #48528