<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/node-new.git/src/node_worker.h, branch devsnek-patch-1</title>
<subtitle>github.com: nodejs/node.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/'/>
<entry>
<title>worker: add eventLoopUtilization()</title>
<updated>2020-10-27T08:43:20+00:00</updated>
<author>
<name>Trevor Norris</name>
<email>trev.norris@gmail.com</email>
</author>
<published>2020-10-14T19:57:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=04d16646a089ff15994e747d31dbc951dbc92e73'/>
<id>04d16646a089ff15994e747d31dbc951dbc92e73</id>
<content type='text'>
Allow calling eventLoopUtilization() directly on a worker thread:

    const worker = new Worker('./foo.js');
    const elu = worker.performance.eventLoopUtilization();
    setTimeout(() =&gt; {
      worker.performance.eventLoopUtilization(elu);
    }, 10);

Add a new performance object on the Worker instance that will hopefully
one day hold all the other performance metrics, such as nodeTiming.

Include benchmarks and tests.

PR-URL: https://github.com/nodejs/node/pull/35664
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Gerhard Stöbich &lt;deb2001-github@yahoo.de&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow calling eventLoopUtilization() directly on a worker thread:

    const worker = new Worker('./foo.js');
    const elu = worker.performance.eventLoopUtilization();
    setTimeout(() =&gt; {
      worker.performance.eventLoopUtilization(elu);
    }, 10);

Add a new performance object on the Worker instance that will hopefully
one day hold all the other performance metrics, such as nodeTiming.

Include benchmarks and tests.

PR-URL: https://github.com/nodejs/node/pull/35664
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Gerhard Stöbich &lt;deb2001-github@yahoo.de&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: add check against non-weak BaseObjects at process exit</title>
<updated>2020-10-07T08:54:34+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-10-03T20:45:08+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=40364b181d44ba90b6ce7cda4f9e3297581121c5'/>
<id>40364b181d44ba90b6ce7cda4f9e3297581121c5</id>
<content type='text'>
When a process exits cleanly, i.e. because the event loop ends up
without things to wait for, the Node.js objects that are left on
the heap should be:

 1. weak, i.e. ready for garbage collection once no longer
    referenced, or
 2. detached, i.e. scheduled for destruction once no longer
    referenced, or
 3. an unrefed libuv handle, i.e. does not keep the event loop
    alive, or
 4. an inactive libuv handle (essentially the same here)

There are a few exceptions to this rule, but generally,
if there are C++-backed Node.js objects on the heap
that do not fall into the above categories, we may be looking
at a potential memory leak. Most likely, the cause is a missing
`MakeWeak()` call on the corresponding object.

In order to avoid this kind of problem, we check the list
of BaseObjects for these criteria. In this commit, we only do so
when explicitly instructed to or when in debug mode
(where --verify-base-objects is always-on).

In particular, this avoids the kinds of memory leak issues
that were fixed in the PRs referenced below.

Refs: https://github.com/nodejs/node/pull/35488
Refs: https://github.com/nodejs/node/pull/35487
Refs: https://github.com/nodejs/node/pull/35481

PR-URL: https://github.com/nodejs/node/pull/35490
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Matteo Collina &lt;matteo.collina@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a process exits cleanly, i.e. because the event loop ends up
without things to wait for, the Node.js objects that are left on
the heap should be:

 1. weak, i.e. ready for garbage collection once no longer
    referenced, or
 2. detached, i.e. scheduled for destruction once no longer
    referenced, or
 3. an unrefed libuv handle, i.e. does not keep the event loop
    alive, or
 4. an inactive libuv handle (essentially the same here)

There are a few exceptions to this rule, but generally,
if there are C++-backed Node.js objects on the heap
that do not fall into the above categories, we may be looking
at a potential memory leak. Most likely, the cause is a missing
`MakeWeak()` call on the corresponding object.

In order to avoid this kind of problem, we check the list
of BaseObjects for these criteria. In this commit, we only do so
when explicitly instructed to or when in debug mode
(where --verify-base-objects is always-on).

In particular, this avoids the kinds of memory leak issues
that were fixed in the PRs referenced below.

Refs: https://github.com/nodejs/node/pull/35488
Refs: https://github.com/nodejs/node/pull/35487
Refs: https://github.com/nodejs/node/pull/35481

PR-URL: https://github.com/nodejs/node/pull/35490
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Matteo Collina &lt;matteo.collina@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: add option to track unmanaged file descriptors</title>
<updated>2020-07-14T13:07:20+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-07-10T23:59:21+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=725cf4764acb515be56b5e414b62f4cf92cf8ecd'/>
<id>725cf4764acb515be56b5e414b62f4cf92cf8ecd</id>
<content type='text'>
Add a public option for Workers which adds tracking for raw
file descriptors, as currently, those resources are not cleaned
up, unlike e.g. `FileHandle`s.

PR-URL: https://github.com/nodejs/node/pull/34303
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Ben Noordhuis &lt;info@bnoordhuis.nl&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a public option for Workers which adds tracking for raw
file descriptors, as currently, those resources are not cleaned
up, unlike e.g. `FileHandle`s.

PR-URL: https://github.com/nodejs/node/pull/34303
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Ben Noordhuis &lt;info@bnoordhuis.nl&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: add stack size resource limit option</title>
<updated>2020-04-29T03:13:42+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-04-27T01:41:56+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=e7b99e027b2fe2fc0834bf2df9daf6d94b27f02b'/>
<id>e7b99e027b2fe2fc0834bf2df9daf6d94b27f02b</id>
<content type='text'>
Add `stackSizeMb` to the `resourceLimit` option group.

Refs: https://github.com/nodejs/node/pull/31593#issuecomment-619633820

PR-URL: https://github.com/nodejs/node/pull/33085
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
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>
Add `stackSizeMb` to the `resourceLimit` option group.

Refs: https://github.com/nodejs/node/pull/31593#issuecomment-619633820

PR-URL: https://github.com/nodejs/node/pull/33085
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
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: unify custom error creation</title>
<updated>2020-04-29T03:12:48+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-04-27T01:36:23+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=ef85bd1908e9550e59dbfa16372b79c1a95ea2a8'/>
<id>ef85bd1908e9550e59dbfa16372b79c1a95ea2a8</id>
<content type='text'>
Mostly, this introduces a pattern that makes sure that if a custom
error is reported, `stopped_` will be set to `true` correctly in
every cast, which was previously missing for the
`NewContext().IsEmpty()` case (which led to a hard crash from the
`Worker` destructor).

This also leaves TODO comments for a few cases in which
`ERR_WORKER_OUT_OF_MEMORY` was not used in accordance with the
documentation for that error code (or according to its intention).
Fixing that is semver-major.

PR-URL: https://github.com/nodejs/node/pull/33084
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.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>
Mostly, this introduces a pattern that makes sure that if a custom
error is reported, `stopped_` will be set to `true` correctly in
every cast, which was previously missing for the
`NewContext().IsEmpty()` case (which led to a hard crash from the
`Worker` destructor).

This also leaves TODO comments for a few cases in which
`ERR_WORKER_OUT_OF_MEMORY` was not used in accordance with the
documentation for that error code (or according to its intention).
Fixing that is semver-major.

PR-URL: https://github.com/nodejs/node/pull/33084
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.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>src: remove loop_init_failed_ from Worker class</title>
<updated>2020-04-02T16:13:09+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-03-30T08:37:57+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=f558a765dad2258176fc70dbecc035f9ed46c8e9'/>
<id>f558a765dad2258176fc70dbecc035f9ed46c8e9</id>
<content type='text'>
There’s no reason for this to not be stored alongside the loop
data structure itself.

PR-URL: https://github.com/nodejs/node/pull/32562
Refs: https://github.com/nodejs/node/pull/32344
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Denys Otrishko &lt;shishugi@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>
There’s no reason for this to not be stored alongside the loop
data structure itself.

PR-URL: https://github.com/nodejs/node/pull/32562
Refs: https://github.com/nodejs/node/pull/32344
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Denys Otrishko &lt;shishugi@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: align worker and main thread code with embedder API</title>
<updated>2020-03-21T09:57:20+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2019-11-11T14:24:13+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=a9fb51f9be570001accfce8a057e885827655a2f'/>
<id>a9fb51f9be570001accfce8a057e885827655a2f</id>
<content type='text'>
This addresses some long-standing TODOs by Joyee and me about
making the embedder API more powerful and us less reliant on
internal APIs for creating the main thread and Workers.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This addresses some long-standing TODOs by Joyee and me about
making the embedder API more powerful and us less reliant on
internal APIs for creating the main thread and Workers.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: emit runtime error on loop creation failure</title>
<updated>2020-02-19T18:54:59+00:00</updated>
<author>
<name>Harshitha KP</name>
<email>harshi46@in.ibm.com</email>
</author>
<published>2020-02-03T05:06:35+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=2d3717ad847665de333c85e5239ad4e6a4c0eb95'/>
<id>2d3717ad847665de333c85e5239ad4e6a4c0eb95</id>
<content type='text'>
Instead of hard asserting throw a runtime error,
that is more consumable.

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

PR-URL: https://github.com/nodejs/node/pull/31621
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of hard asserting throw a runtime error,
that is more consumable.

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

PR-URL: https://github.com/nodejs/node/pull/31621
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>worker: properly handle env and NODE_OPTIONS in workers</title>
<updated>2020-02-13T15:05:27+00:00</updated>
<author>
<name>Denys Otrishko</name>
<email>shishugi@gmail.com</email>
</author>
<published>2020-02-09T22:18:10+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=d63bcdd9cd81b10b6158f40d44bf6f37e5f54385'/>
<id>d63bcdd9cd81b10b6158f40d44bf6f37e5f54385</id>
<content type='text'>
PR-URL: https://github.com/nodejs/node/pull/31711
Fixes: https://github.com/nodejs/node/issues/30627
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR-URL: https://github.com/nodejs/node/pull/31711
Fixes: https://github.com/nodejs/node/issues/30627
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Benjamin Gruenbaum &lt;benjamingr@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>src: remove unused `Worker::child_port_` member</title>
<updated>2020-02-04T06:02:34+00:00</updated>
<author>
<name>Anna Henningsen</name>
<email>anna@addaleax.net</email>
</author>
<published>2020-02-01T10:42:30+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=60de60a0ce21378c80353489759dc70f05156cc7'/>
<id>60de60a0ce21378c80353489759dc70f05156cc7</id>
<content type='text'>
This fixes a compiler warning introduced in 9225939528590f652e6.

PR-URL: https://github.com/nodejs/node/pull/31599
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@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>
This fixes a compiler warning introduced in 9225939528590f652e6.

PR-URL: https://github.com/nodejs/node/pull/31599
Reviewed-By: Gireesh Punathil &lt;gpunathi@in.ibm.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
