Skip to content
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

n-api: napi_make_callback with async_hooks.executionAsyncResource #32898

Closed
legendecas opened this issue Apr 17, 2020 · 5 comments
Closed

n-api: napi_make_callback with async_hooks.executionAsyncResource #32898

legendecas opened this issue Apr 17, 2020 · 5 comments
Assignees
Labels
async_hooks Issues and PRs related to the async hooks subsystem. node-api Issues and PRs related to the Node-API.

Comments

@legendecas
Copy link
Member

legendecas commented Apr 17, 2020

  • 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.

@legendecas legendecas added async_hooks Issues and PRs related to the async hooks subsystem. node-api Issues and PRs related to the Node-API. labels Apr 17, 2020
@legendecas legendecas self-assigned this Apr 17, 2020
@puzpuzpuz
Copy link
Member

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

@legendecas
Copy link
Member Author

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

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

@legendecas legendecas changed the title n-api: napi_make_callback with async_hooks.executionResource n-api: napi_make_callback with async_hooks.executionAsyncResource Apr 17, 2020
@puzpuzpuz
Copy link
Member

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

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

@Qard
Copy link
Member

Qard commented Apr 20, 2020

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

@legendecas
Copy link
Member Author

@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)

targos pushed a commit that referenced this issue Nov 3, 2020
instead of emit async init with receiver of the callback.

PR-URL: #32930
Fixes: #32898
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
BethGriggs pushed a commit that referenced this issue Dec 8, 2020
instead of emit async init with receiver of the callback.

PR-URL: #32930
Fixes: #32898
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
BethGriggs pushed a commit that referenced this issue Dec 10, 2020
instead of emit async init with receiver of the callback.

PR-URL: #32930
Fixes: #32898
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
BethGriggs pushed a commit that referenced this issue Dec 15, 2020
instead of emit async init with receiver of the callback.

PR-URL: #32930
Fixes: #32898
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. node-api Issues and PRs related to the Node-API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants