-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.diag-agendaIssues and PRs to discuss during the meetings of the diagnostics working group.Issues and PRs to discuss during the meetings of the diagnostics working group.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.
Description
- Version: v8.0.0
- Platform: All
- Subsystem: async_hooks, promises
Currently, there is no way (using async_hooks) to associate a PromiseReactionJob with the async id that fulfilled that promise. There is also no way to get the timing of the kResolved promise life cycle hook. These may be 2 separate issues, but are closely related.
Currently here is what is available for promises:
- init (Promise creation):
currentId: the async_id of the current execution context when the promise is createdtriggerId: (once async_hooks: use parent promise as triggerId in init hookΒ #13367 lands) The id of the parent promiseasyncId: an async id for the new promiseasync_hooks.currentId(): same ascurrentIdasync_hooks.triggerId(): trigger id for the current execution context (not the same as triggerId argument)
- before (start of PromiseReactionJob)
asyncId: an async id for the promiseasync_hooks.currentId(): same asasyncId(once async_hooks.currentId() sometimes reports the wrong id during PromiseReactionJobΒ #13427 is fixed)- `async_hooks.triggerId(): currently also affected by async_hooks.currentId() sometimes reports the wrong id during PromiseReactionJobΒ #13427 (either parentPromise id or same as currentId?)
- after (end of PromiseReactionJob)
asyncId: an async id for the promiseasync_hooks.currentId(): same asasyncId(once async_hooks.currentId() sometimes reports the wrong id during PromiseReactionJobΒ #13427 is fixed)async_hooks.triggerId(): currently also affected by async_hooks.currentId() sometimes reports the wrong id during PromiseReactionJobΒ #13427 (either parentPromise id or same as currentId?)
Ideally there would be a way to access the id of the async context active during kResolved from the before/after hooks. Initially I had expected that during a PromiseReactionJob calling async_hooks.triggeredId() would return the contextId of the context responsible for resolving the promise. I am not sure if this is right approach. but having some way to link these 2 contexts is important for the apm use case.
oakfang
Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.diag-agendaIssues and PRs to discuss during the meetings of the diagnostics working group.Issues and PRs to discuss during the meetings of the diagnostics working group.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.