You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
napi_make_callback() with null async_context doesn't reuse current context #35188
Call back sync to javascript from native using napi_make_callback() with async_context set to NULL.
The simplest way to reproduce this is to add following code in test/node-api/test_make_callback_recurse/test.js
According to docs I would expect the test to pass as they tell However NULL is also allowed, which indicates the current async context (if any) is to be used for the callback..
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
I would expect that the current async id is not changed.
What do you see instead?
async_id 0 is used
Additional information
I'm not sure here if the docs should be corrected or the implementation.
Maybe we should even disallow to pass NULL to napi_make_callback().
Activity
Flarna commentedon Sep 15, 2020
fyi @nodejs/n-api I'm happy to create a PR to correct this but I'm not sure if it is a doc issue or a implemenation issue.
mhdawson commentedon Sep 18, 2020
We discussed in the meeting today, and we think that it's most likely a bug versus doc issue. PR would be welcome.
doc: update napi_make_callback documentation
doc: update napi_make_callback documentation
doc: update napi_make_callback documentation