<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/node-new.git/src/node_worker.h, branch try_Python3_on_macOS</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>worker: fix crash when SharedArrayBuffer outlives creating thread</title>
<updated>2019-08-19T22:14:10+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2019-08-17T22:05:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=119c4ccf0ef2addc84fd638004a631f55c7aefc9'/>
<id>119c4ccf0ef2addc84fd638004a631f55c7aefc9</id>
<content type='text'>
Keep a reference to the `ArrayBuffer::Allocator` alive for at least
as long as a `SharedArrayBuffer` allocated by it lives.

Refs: https://github.com/nodejs/node/pull/28788
Fixes: https://github.com/nodejs/node/issues/28777
Fixes: https://github.com/nodejs/node/issues/28773

PR-URL: https://github.com/nodejs/node/pull/29190
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Keep a reference to the `ArrayBuffer::Allocator` alive for at least
as long as a `SharedArrayBuffer` allocated by it lives.

Refs: https://github.com/nodejs/node/pull/28788
Fixes: https://github.com/nodejs/node/issues/28777
Fixes: https://github.com/nodejs/node/issues/28773

PR-URL: https://github.com/nodejs/node/pull/29190
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: refactor `worker.terminate()`</title>
<updated>2019-06-17T12:27:17+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2019-06-02T13:09:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=ed24c19002379063ce100037bfff7ca2da5b6cc8'/>
<id>ed24c19002379063ce100037bfff7ca2da5b6cc8</id>
<content type='text'>
At the collaborator summit in Berlin, the behaviour of
`worker.terminate()` was discussed.

In particular, switching from a callback-based to a Promise-based API
was suggested. While investigating that possibility later, it was
discovered that `.terminate()` was unintentionally synchronous up
until now (including calling its callback synchronously).

Also, the topic of its stability has been brought up. I have performed
two manual reviews of the native codebase for compatibility with
`.terminate()`, and performed some manual fuzz testing with the test
suite. At this point, bugs with `.terminate()` should, in my opinion,
be treated like bugs in other Node.js features.
(It is possible to make Node.js crash with `.terminate()` by messing
with internals and/or built-in prototype objects, but that is already
the case without `.terminate()` as well.)

This commit:

- Makes `.terminate()` an asynchronous operation.
- Makes `.terminate()` return a `Promise`.
- Runtime-deprecates passing a callback.
- Removes a warning about its stability from the documentation.
- Eliminates an unnecessary extra function from the C++ code.

A possible alternative to returning a `Promise` would be to keep the
method synchronous and just drop the callback. Generally, providing
an asynchronous API does provide us with a bit more flexibility.

Refs: https://github.com/nodejs/summit/issues/141

PR-URL: https://github.com/nodejs/node/pull/28021
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Ben Noordhuis &lt;info@bnoordhuis.nl&gt;
Reviewed-By: Tiancheng "Timothy" Gu &lt;timothygu99@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.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>
At the collaborator summit in Berlin, the behaviour of
`worker.terminate()` was discussed.

In particular, switching from a callback-based to a Promise-based API
was suggested. While investigating that possibility later, it was
discovered that `.terminate()` was unintentionally synchronous up
until now (including calling its callback synchronously).

Also, the topic of its stability has been brought up. I have performed
two manual reviews of the native codebase for compatibility with
`.terminate()`, and performed some manual fuzz testing with the test
suite. At this point, bugs with `.terminate()` should, in my opinion,
be treated like bugs in other Node.js features.
(It is possible to make Node.js crash with `.terminate()` by messing
with internals and/or built-in prototype objects, but that is already
the case without `.terminate()` as well.)

This commit:

- Makes `.terminate()` an asynchronous operation.
- Makes `.terminate()` return a `Promise`.
- Runtime-deprecates passing a callback.
- Removes a warning about its stability from the documentation.
- Eliminates an unnecessary extra function from the C++ code.

A possible alternative to returning a `Promise` would be to keep the
method synchronous and just drop the callback. Generally, providing
an asynchronous API does provide us with a bit more flexibility.

Refs: https://github.com/nodejs/summit/issues/141

PR-URL: https://github.com/nodejs/node/pull/28021
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Ben Noordhuis &lt;info@bnoordhuis.nl&gt;
Reviewed-By: Tiancheng "Timothy" Gu &lt;timothygu99@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: reorganize inspector and diagnostics initialization</title>
<updated>2019-06-03T15:27:49+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2019-05-20T11:39:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=a0d86befb5251736af84a5d261ba49948baf7c73'/>
<id>a0d86befb5251736af84a5d261ba49948baf7c73</id>
<content type='text'>
- Split the initialization of the inspector and other diagnostics
  into `Environment::InitializeInspector()` and
  `Environment::InitializeDiagnostics()` - these need to be
  reinitialized separately after snapshot deserialization.
- Do not store worker url alongside the inspector parent handle,
  instead just get it from the handle.
- Rename `Worker::profiler_idle_notifier_started_` to
  `Worker::start_profiler_idle_notifier_` because it stores
  the state inherited from the parent env to use for initializing
  itself.

PR-URL: https://github.com/nodejs/node/pull/27539
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Split the initialization of the inspector and other diagnostics
  into `Environment::InitializeInspector()` and
  `Environment::InitializeDiagnostics()` - these need to be
  reinitialized separately after snapshot deserialization.
- Do not store worker url alongside the inspector parent handle,
  instead just get it from the handle.
- Rename `Worker::profiler_idle_notifier_started_` to
  `Worker::start_profiler_idle_notifier_` because it stores
  the state inherited from the parent env to use for initializing
  itself.

PR-URL: https://github.com/nodejs/node/pull/27539
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>process: store argv in Environment</title>
<updated>2019-04-03T21:14:52+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2019-03-19T23:55:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=d005f382cdcec7dff1d61cf5ab3604e55f004471'/>
<id>d005f382cdcec7dff1d61cf5ab3604e55f004471</id>
<content type='text'>
This gets rid of Environment::ExecutionMode as well now that
we use the original arguments to determine execution mode.

PR-URL: https://github.com/nodejs/node/pull/26945
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This gets rid of Environment::ExecutionMode as well now that
we use the original arguments to determine execution mode.

PR-URL: https://github.com/nodejs/node/pull/26945
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: use copy of process.env</title>
<updated>2019-03-30T21:25:35+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2019-02-22T19:11:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=9fbf0c60b583dae3d34598352c3c7614118cd035'/>
<id>9fbf0c60b583dae3d34598352c3c7614118cd035</id>
<content type='text'>
Instead of sharing the OS-backed store for all `process.env` instances,
create a copy of `process.env` for every worker that is created.

The copies do not interact. Native-addons do not see modifications to
`process.env` from Worker threads, but child processes started from
Workers do default to the Worker’s copy of `process.env`.

This makes Workers behave like child processes as far as `process.env`
is concerned, and an option corresponding to the `child_process`
module’s `env` option is added to the constructor.

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

PR-URL: https://github.com/nodejs/node/pull/26544
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Vse Mozhet Byt &lt;vsemozhetbyt@gmail.com&gt;
Reviewed-By: Yongsheng Zhang &lt;zyszys98@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of sharing the OS-backed store for all `process.env` instances,
create a copy of `process.env` for every worker that is created.

The copies do not interact. Native-addons do not see modifications to
`process.env` from Worker threads, but child processes started from
Workers do default to the Worker’s copy of `process.env`.

This makes Workers behave like child processes as far as `process.env`
is concerned, and an option corresponding to the `child_process`
module’s `env` option is added to the constructor.

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

PR-URL: https://github.com/nodejs/node/pull/26544
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Vse Mozhet Byt &lt;vsemozhetbyt@gmail.com&gt;
Reviewed-By: Yongsheng Zhang &lt;zyszys98@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: initialize worker's stack_base_ field</title>
<updated>2019-03-22T08:19:03+00:00</updated>
<author>
<name>cjihrig</name>
<email>cjihrig@gmail.com</email>
</author>
<published>2019-03-18T14:09:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=76387c1c2070cf444a0bd247c86c247c167ec742'/>
<id>76387c1c2070cf444a0bd247c86c247c167ec742</id>
<content type='text'>
Coverity was complaining that this field was not initialized.

PR-URL: https://github.com/nodejs/node/pull/26739
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
Reviewed-By: Yongsheng Zhang &lt;zyszys98@gmail.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>
Coverity was complaining that this field was not initialized.

PR-URL: https://github.com/nodejs/node/pull/26739
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
Reviewed-By: Yongsheng Zhang &lt;zyszys98@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: create per-Environment message port after bootstrap</title>
<updated>2019-03-19T13:00:48+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2019-03-11T16:42:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=9868d544119409750231d4a5ff94a356385b126d'/>
<id>9868d544119409750231d4a5ff94a356385b126d</id>
<content type='text'>
PR-URL: https://github.com/nodejs/node/pull/26593
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR-URL: https://github.com/nodejs/node/pull/26593
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: shutdown node in-flight</title>
<updated>2019-03-16T07:20:26+00:00</updated>
<author>
<name>Gireesh Punathil</name>
<email>gpunathi@in.ibm.com</email>
</author>
<published>2018-06-12T13:01:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=d35af56e5f3b1334c4360dbf8a013d0c522fe5f8'/>
<id>d35af56e5f3b1334c4360dbf8a013d0c522fe5f8</id>
<content type='text'>
This commit introduces a `node::Stop()` API.

An identified use case for embedders is their ability to tear down
Node while it is still running (event loop contain pending events)

Here the assumptions are that (i) embedders do not wish to resort to
JS routines to initiate shutdown (ii) embedders have the Environment
handle handy. (iii) embedders stop Node through a second thread.

Fixes: https://github.com/nodejs/node/issues/19365
Refs: https://github.com/nodejs/user-feedback/issues/51

PR-URL: https://github.com/nodejs/node/pull/21283
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Richard Lau &lt;riclau@uk.ibm.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>
This commit introduces a `node::Stop()` API.

An identified use case for embedders is their ability to tear down
Node while it is still running (event loop contain pending events)

Here the assumptions are that (i) embedders do not wish to resort to
JS routines to initiate shutdown (ii) embedders have the Environment
handle handy. (iii) embedders stop Node through a second thread.

Fixes: https://github.com/nodejs/node/issues/19365
Refs: https://github.com/nodejs/user-feedback/issues/51

PR-URL: https://github.com/nodejs/node/pull/21283
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Richard Lau &lt;riclau@uk.ibm.com&gt;
Reviewed-By: Michael Dawson &lt;Michael_Dawson@ca.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: provide process.execArgv</title>
<updated>2019-03-02T12:16:35+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2019-02-22T20:01:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=f65b4afaea14446c4b313595c03b737ab710c124'/>
<id>f65b4afaea14446c4b313595c03b737ab710c124</id>
<content type='text'>
Provide `process.execArgv`. If an `execArgv` option is passed to the
`Worker` constructor, that option is used as its value; if not,
the parent’s `process.execArgv` is inherited (since that also goes
for the actual options in that case).

PR-URL: https://github.com/nodejs/node/pull/26267
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.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>
Provide `process.execArgv`. If an `execArgv` option is passed to the
`Worker` constructor, that option is used as its value; if not,
the parent’s `process.execArgv` is inherited (since that also goes
for the actual options in that case).

PR-URL: https://github.com/nodejs/node/pull/26267
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: refactor thread life cycle management</title>
<updated>2019-03-01T09:14:55+00:00</updated>
<author>
<name>Gireesh Punathil</name>
<email>gpunathi@in.ibm.com</email>
</author>
<published>2019-02-17T10:24:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=d14cba401a425dc184f929b38442b1d996cdd5f6'/>
<id>d14cba401a425dc184f929b38442b1d996cdd5f6</id>
<content type='text'>
The current mechanism of uses two async handles, one owned by the
creator of the worker thread to terminate a running worker,
and another one employed by the worker to interrupt its creator on its
natural termination. The force termination piggybacks on the message-
passing mechanism to inform the worker to quiesce.

Also there are few flags that represent the other thread's state /
request state because certain code path is shared by multiple
control flows, and there are certain code path where the async
handles may not have come to life.

Refactor into an AsyncRequest abstraction that exposes routines to
install a handle as well as to save a state.

PR-URL: https://github.com/nodejs/node/pull/26099
Refs: https://github.com/nodejs/node/pull/21283
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current mechanism of uses two async handles, one owned by the
creator of the worker thread to terminate a running worker,
and another one employed by the worker to interrupt its creator on its
natural termination. The force termination piggybacks on the message-
passing mechanism to inform the worker to quiesce.

Also there are few flags that represent the other thread's state /
request state because certain code path is shared by multiple
control flows, and there are certain code path where the async
handles may not have come to life.

Refactor into an AsyncRequest abstraction that exposes routines to
install a handle as well as to save a state.

PR-URL: https://github.com/nodejs/node/pull/26099
Refs: https://github.com/nodejs/node/pull/21283
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
