Skip to content

n-api: napi_make_callback with async_hooks.executionAsyncResource #32898

Description

@legendecas
  • Version: n-api v6/ v14.0.0-pre
  • Platform: all
  • Subsystem: n-api, async_hooks

During the callback of napi_make_callback, async_hooks.executionAsyncResource() doesn't reflect the resource object of the given async_context. Rather, it's the receiver of napi_make_callback.

Activity

  1. added
    async_hooksIssues and PRs related to the async hooks subsystem.
    node-apiIssues and PRs related to Node-API.
    on Apr 17, 2020
  2. self-assigned this
    on Apr 17, 2020
  3. puzpuzpuz commented on Apr 17, 2020

    @puzpuzpuz
    Member

    Do you mean async_hooks.executionAsyncResource() by async_hooks.executionResource or it's something different?

  4. legendecas commented on Apr 17, 2020

    @legendecas
    MemberAuthor

    Do you mean async_hooks.executionAsyncResource() by async_hooks.executionResource or it's something different?

    Yes, it’s async_hooks.executionAsyncResource(). Updated.

  5. changed the title [-]n-api: napi_make_callback with async_hooks.executionResource[/-] [+]n-api: napi_make_callback with async_hooks.executionAsyncResource[/+] on Apr 17, 2020
  6. puzpuzpuz commented on Apr 17, 2020

    @puzpuzpuz
    Member

    Yes, it’s async_hooks.executionAsyncResource(). Updated.

    Good to know. Then this issue may be of some interest for @Qard

  7. Qard commented on Apr 20, 2020

    @Qard
    Member

    Yep. This is a known issue. Could maybe be fixed here by attempting an unwrap to an AsyncWrap and using the GetResource() method. 🤔

  8. legendecas commented on Apr 21, 2020

    @legendecas
    MemberAuthor

    @Qard #32930 I submitted a PR to wrap the N-API async context similar to AsyncWrap. (In the case, AsyncWrap is not suitable since the resource object in the N-API may have no internal slot, which fails the BaseObject's assertion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

async_hooksIssues and PRs related to the async hooks subsystem.node-apiIssues and PRs related to Node-API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions