async_hooks: separate missing from default context · nodejs/node@f56eb2a · GitHub
Skip to content

Commit f56eb2a

Browse files
AndreasMadsenevanlucas
authored andcommitted
async_hooks: separate missing from default context
When context is missing the executionAsyncId will be zero. For the default triggerAsyncId the zero value was used to default to the executionAsyncId. While this was not technically wrong because the functions are different themself, it poorly separated the two concepts. Backport-PR-URL: #18079 PR-URL: #17273 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2a4f849 commit f56eb2a

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

lib/internal/async_hooks.js

Lines changed: 3 additions & 3 deletions

lib/internal/bootstrap_node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@
375375

376376
// It's possible that kDefaultTriggerAsyncId was set for a constructor
377377
// call that threw and was never cleared. So clear it now.
378-
async_id_fields[kDefaultTriggerAsyncId] = 0;
378+
async_id_fields[kDefaultTriggerAsyncId] = -1;
379379

380380
if (exceptionHandlerState.captureFn !== null) {
381381
exceptionHandlerState.captureFn(er);

src/env-inl.h

Lines changed: 8 additions & 2 deletions

0 commit comments

Comments
 (0)