<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/node-new.git/src/node_api.cc, branch devsnek-patch-1</title>
<subtitle>github.com: nodejs/node.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/'/>
<entry>
<title>n-api: factor out calling pattern</title>
<updated>2020-11-16T05:48:27+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2020-11-13T21:07:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=2fd22353ea1ab6d24057e247635cebbbb180da91'/>
<id>2fd22353ea1ab6d24057e247635cebbbb180da91</id>
<content type='text'>
Factor out how we handle a `napi_status`-valued return internally.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
PR-URL: https://github.com/nodejs/node/pull/36113
Reviewed-By: Stephen Belanger &lt;admin@stephenbelanger.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Factor out how we handle a `napi_status`-valued return internally.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
PR-URL: https://github.com/nodejs/node/pull/36113
Reviewed-By: Stephen Belanger &lt;admin@stephenbelanger.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: napi_make_callback emit async init with resource of async_context</title>
<updated>2020-10-31T00:17:59+00:00</updated>
<author>
<name>legendecas</name>
<email>legendecas@gmail.com</email>
</author>
<published>2020-10-06T18:05:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=3a7537de7dd6c833cbe3f14b58e289c0a905afa5'/>
<id>3a7537de7dd6c833cbe3f14b58e289c0a905afa5</id>
<content type='text'>
instead of emit async init with receiver of the callback.

PR-URL: https://github.com/nodejs/node/pull/32930
Fixes: https://github.com/nodejs/node/issues/32898
Reviewed-By: Stephen Belanger &lt;admin@stephenbelanger.com&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Gerhard Stöbich &lt;deb2001-github@yahoo.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
instead of emit async init with receiver of the callback.

PR-URL: https://github.com/nodejs/node/pull/32930
Fixes: https://github.com/nodejs/node/issues/32898
Reviewed-By: Stephen Belanger &lt;admin@stephenbelanger.com&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Gerhard Stöbich &lt;deb2001-github@yahoo.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: allow N-API addon in `AddLinkedBinding()`</title>
<updated>2020-09-26T08:22:47+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-09-22T18:35:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=ff38165820da2a9eaddabbce23f3e75aa502900b'/>
<id>ff38165820da2a9eaddabbce23f3e75aa502900b</id>
<content type='text'>
`AddLinkedBinding()` can be used to load old-style Node.js addons, but
currently not N-API addons. There’s no good reason not to support
N-API addons as well, so add that.

PR-URL: https://github.com/nodejs/node/pull/35301
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Zeyu Yang &lt;himself65@outlook.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`AddLinkedBinding()` can be used to load old-style Node.js addons, but
currently not N-API addons. There’s no good reason not to support
N-API addons as well, so add that.

PR-URL: https://github.com/nodejs/node/pull/35301
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Zeyu Yang &lt;himself65@outlook.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: re-implement async env cleanup hooks</title>
<updated>2020-08-27T15:18:37+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2020-08-17T17:13:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=0848f56cb39432090cdb99af9b8541fbc1a2849c'/>
<id>0848f56cb39432090cdb99af9b8541fbc1a2849c</id>
<content type='text'>
* Avoid passing core `void*` and function pointers into add-on.
* Document `napi_async_cleanup_hook_handle` type.
* Render receipt of the handle mandatory from the point where the
  hook gets called. Removal of the handle remains mandatory.

Fixes: https://github.com/nodejs/node/issues/34715
Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Co-authored-by: Anna Henningsen &lt;github@addaleax.net&gt;
PR-URL: https://github.com/nodejs/node/pull/34819
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Zeyu Yang &lt;himself65@outlook.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Avoid passing core `void*` and function pointers into add-on.
* Document `napi_async_cleanup_hook_handle` type.
* Render receipt of the handle mandatory from the point where the
  hook gets called. Removal of the handle remains mandatory.

Fixes: https://github.com/nodejs/node/issues/34715
Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Co-authored-by: Anna Henningsen &lt;github@addaleax.net&gt;
PR-URL: https://github.com/nodejs/node/pull/34819
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Zeyu Yang &lt;himself65@outlook.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: fix use-after-free with napi_remove_async_cleanup_hook</title>
<updated>2020-08-07T18:25:42+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-08-07T10:48:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=262d0d0482ffd2fe7d654422df9df1f350045635'/>
<id>262d0d0482ffd2fe7d654422df9df1f350045635</id>
<content type='text'>
Fixes: https://github.com/nodejs/node/issues/34657
Refs: https://github.com/nodejs/node/pull/34572

PR-URL: https://github.com/nodejs/node/pull/34662
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes: https://github.com/nodejs/node/issues/34657
Refs: https://github.com/nodejs/node/pull/34572

PR-URL: https://github.com/nodejs/node/pull/34662
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api,src: provide asynchronous cleanup hooks</title>
<updated>2020-08-06T22:02:02+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-07-31T00:10:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=22cbbcf9d9374d4b663bf1409f292212fa57623a'/>
<id>22cbbcf9d9374d4b663bf1409f292212fa57623a</id>
<content type='text'>
Sometimes addons need to perform cleanup actions, for example
closing libuv handles or waiting for requests to finish, that
cannot be performed synchronously.

Add C++ API and N-API functions that allow providing such
asynchronous cleanup hooks.

Fixes: https://github.com/nodejs/node/issues/34567

PR-URL: https://github.com/nodejs/node/pull/34572
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sometimes addons need to perform cleanup actions, for example
closing libuv handles or waiting for requests to finish, that
cannot be performed synchronously.

Add C++ API and N-API functions that allow providing such
asynchronous cleanup hooks.

Fixes: https://github.com/nodejs/node/issues/34567

PR-URL: https://github.com/nodejs/node/pull/34572
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: run all finalizers via SetImmediate()</title>
<updated>2020-07-24T06:28:09+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2020-07-15T22:45:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=a74a6e3ba131752225a527d915593d7e413b1594'/>
<id>a74a6e3ba131752225a527d915593d7e413b1594</id>
<content type='text'>
Throwing an exception from a finalizer can cause the following fatal
error:

Error: async hook stack has become corrupted (actual: 2, expected: 0)
 1: 0x970b5a node::InternalCallbackScope::~InternalCallbackScope()
    [./node]
 2: 0x99dda0 node::Environment::RunTimers(uv_timer_s*) [./node]
 3: 0x13d8b22  [./node]
 4: 0x13dbe42 uv_run [./node]
 5: 0xa57974 node::NodeMainInstance::Run() [./node]
 6: 0x9dbc17 node::Start(int, char**) [./node]
 7: 0x7f4965417f43 __libc_start_main [/lib64/libc.so.6]
 8: 0x96f4ae _start [./node]

By https://github.com/nodejs/node/issues/34341#issuecomment-658426281,
calling into JS from a finalizer and/or throwing exceptions from there
is not advised, because the stack may or may not be set up for JS
execution. The best solution is to run the user's finalizer from a
`SetImmediate()` callback.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Fixes: https://github.com/nodejs/node/issues/34341
PR-URL: https://github.com/nodejs/node/pull/34386
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Throwing an exception from a finalizer can cause the following fatal
error:

Error: async hook stack has become corrupted (actual: 2, expected: 0)
 1: 0x970b5a node::InternalCallbackScope::~InternalCallbackScope()
    [./node]
 2: 0x99dda0 node::Environment::RunTimers(uv_timer_s*) [./node]
 3: 0x13d8b22  [./node]
 4: 0x13dbe42 uv_run [./node]
 5: 0xa57974 node::NodeMainInstance::Run() [./node]
 6: 0x9dbc17 node::Start(int, char**) [./node]
 7: 0x7f4965417f43 __libc_start_main [/lib64/libc.so.6]
 8: 0x96f4ae _start [./node]

By https://github.com/nodejs/node/issues/34341#issuecomment-658426281,
calling into JS from a finalizer and/or throwing exceptions from there
is not advised, because the stack may or may not be set up for JS
execution. The best solution is to run the user's finalizer from a
`SetImmediate()` callback.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Fixes: https://github.com/nodejs/node/issues/34341
PR-URL: https://github.com/nodejs/node/pull/34386
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: add public method for marking objects as untransferable</title>
<updated>2020-06-25T15:33:29+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-06-19T18:39:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=88fb5a5c7933022de750745e51e5dc0996a1e2c4'/>
<id>88fb5a5c7933022de750745e51e5dc0996a1e2c4</id>
<content type='text'>
We currently mark a number of `ArrayBuffer`s as not transferable,
including the `Buffer` pool and ones with finalizers provided
by C++ addons.

There is no good reason to assume that userland code might not
encounter similar problems, for example when doing `ArrayBuffer`
pooling similar to ours. Therefore, provide an API that lets
userland code also mark objects as not transferable.

PR-URL: https://github.com/nodejs/node/pull/33979
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We currently mark a number of `ArrayBuffer`s as not transferable,
including the `Buffer` pool and ones with finalizers provided
by C++ addons.

There is no good reason to assume that userland code might not
encounter similar problems, for example when doing `ArrayBuffer`
pooling similar to ours. Therefore, provide an API that lets
userland code also mark objects as not transferable.

PR-URL: https://github.com/nodejs/node/pull/33979
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: remove `napi_env::CallIntoModuleThrow`</title>
<updated>2020-05-28T20:28:56+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2020-05-26T15:32:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=6a1df3b5afc92f438cf84621abd8cda79d9b1b17'/>
<id>6a1df3b5afc92f438cf84621abd8cda79d9b1b17</id>
<content type='text'>
Give `napi_env::CallIntoModule` the thrower used by
`CallIntoModuleThrow` as its default second argument. That way we do
not need two different methods on `napi_env` for calling into the
addon.

PR-URL: https://github.com/nodejs/node/pull/33570
Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Chengzhong Wu &lt;legendecas@gmail.com&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Give `napi_env::CallIntoModule` the thrower used by
`CallIntoModuleThrow` as its default second argument. That way we do
not need two different methods on `napi_env` for calling into the
addon.

PR-URL: https://github.com/nodejs/node/pull/33570
Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Chengzhong Wu &lt;legendecas@gmail.com&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "n-api: detect deadlocks in thread-safe function"</title>
<updated>2020-05-23T15:45:42+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-05-18T04:50:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=b18d8dde847e1bff188c6cfb2d65a96209146c2c'/>
<id>b18d8dde847e1bff188c6cfb2d65a96209146c2c</id>
<content type='text'>
This reverts commit d26ca06c16f497ffa5ac4845a27922d5058a9318 because
it breaks running the tests in debug mode, as
`v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active
on the current thread.

Refs: https://github.com/nodejs/node/pull/33276
Refs: https://github.com/nodejs/node/pull/32860

PR-URL: https://github.com/nodejs/node/pull/33453
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: David Carlier &lt;devnexen@gmail.com&gt;
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit d26ca06c16f497ffa5ac4845a27922d5058a9318 because
it breaks running the tests in debug mode, as
`v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active
on the current thread.

Refs: https://github.com/nodejs/node/pull/33276
Refs: https://github.com/nodejs/node/pull/32860

PR-URL: https://github.com/nodejs/node/pull/33453
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: David Carlier &lt;devnexen@gmail.com&gt;
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
Reviewed-By: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
