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

embedding: provide hook for custom process.exit() behaviour #32531

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

Embedders may not want to terminate the process when process.exit()
is called. This provides a hook for more flexible handling of that
situation.

Refs: #30467 (comment) (/cc @linroid)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@addaleax addaleax added semver-minor PRs that contain new features and should be released in the next minor version. embedding Issues and PRs related to embedding Node.js in another project. labels Mar 28, 2020
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Mar 28, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 28, 2020

CI: https://ci.nodejs.org/job/node-test-pull-request/30151/ (:heavy_check_mark:)

@himself65
Copy link
Member

no doc update?

@addaleax
Copy link
Member Author

@himself65 The documentation for our public C++ API is provided as comments in node.h – that’s the customary way of documenting C++ APIs. We have an embedding doc now, but that’s mostly there to provide an example, and also links to node.h for more information.

src/env.cc Outdated
} else {
worker_context()->Exit(exit_code);
}
stop_sub_worker_contexts();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this an un-necessary call for workers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gireeshpunathil So … no, but thanks for pointing this out.

My line of thinking here was “both the main thread and Workers perform this call anyway, so why not do it at the same time so that behavior is more similar and therefore less prone to bugs”.

While that was not wrong, it introduced a bug that I wouldn’t have noticed if you hadn’t commented; Because this happens without setting can_call_into_js() to false, the Workers are stopped and their exit events would be emitted. We generally don’t want asynchronous resources to emit events during process.exit(), so that’s a bug.

The change here meant that this bug would also occur when running nested Workers, but on the main thread, it has been present before. I’ve opened #32546 fixes that (and this PR is rebased on top of it), and marked this PR as blocked until that one lands, because this is semver-minor and the other PR is semver-patch, and our tooling doesn’t like mixing them.

I’ve also added a commit here that makes Stop(env) stop Worker threads – that seems like a sensible thing to do, and achieves my original goal of being more consistent between Worker threads and the main thread.

src/node.h Outdated
@@ -473,6 +473,17 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {});
NODE_EXTERN void FreeEnvironment(Environment* env);

// Set a callback that is called when process.exit() is called from JS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

called when process.exit() is called from JS. might make some users think that the callback in invoked after the default process.exit has been actioned?

called in response to process.exit() call from JS. may be a better wording?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

called when process.exit() is called from JS. might make some users think that the callback in invoked after the default process.exit has been actioned?

The default process.exit() terminates the process, which by definition precludes any other code from being run afterwards, so I don’t think that that is a very likely reading of this phrasing (or at least one that would appear self-contradictory).

called in response to process.exit() call from JS. may be a better wording?

I’d be worried that that makes it sound like an asynchronous call, when it is really called during process.exit() itself.

I’ve added wording that explicitly specifies that this overrides the default handler, I hope that helps.

@addaleax addaleax added the blocked PRs that are blocked by other issues or PRs. label Mar 29, 2020
@addaleax
Copy link
Member Author

addaleax commented Mar 29, 2020

Blocked until #32546 lands, see #32531 (comment) for details

EDIT: Also blocked on #32548

@nodejs-github-bot
Copy link
Collaborator

Embedders may not want to terminate the process when `process.exit()`
is called. This provides a hook for more flexible handling of that
situation.

Refs: nodejs#30467 (comment)
This makes sense given that terminating execution of the parent thread
this way likely also is supposed to stop all running Worker threads
spawned by it.
@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed blocked PRs that are blocked by other issues or PRs. labels Apr 2, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

addaleax added a commit that referenced this pull request Apr 2, 2020
Embedders may not want to terminate the process when `process.exit()`
is called. This provides a hook for more flexible handling of that
situation.

Refs: #30467 (comment)

PR-URL: #32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Apr 2, 2020
This makes sense given that terminating execution of the parent thread
this way likely also is supposed to stop all running Worker threads
spawned by it.

PR-URL: #32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit to addaleax/node that referenced this pull request Sep 23, 2020
Embedders may not want to terminate the process when `process.exit()`
is called. This provides a hook for more flexible handling of that
situation.

Refs: nodejs#30467 (comment)

PR-URL: nodejs#32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit to addaleax/node that referenced this pull request Sep 23, 2020
This makes sense given that terminating execution of the parent thread
this way likely also is supposed to stop all running Worker threads
spawned by it.

PR-URL: nodejs#32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Sep 23, 2020
Embedders may not want to terminate the process when `process.exit()`
is called. This provides a hook for more flexible handling of that
situation.

Refs: #30467 (comment)

Backport-PR-URL: #35241
PR-URL: #32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax added a commit that referenced this pull request Sep 23, 2020
This makes sense given that terminating execution of the parent thread
this way likely also is supposed to stop all running Worker threads
spawned by it.

Backport-PR-URL: #35241
PR-URL: #32531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
codebytere added a commit that referenced this pull request Sep 28, 2020
Notable changes:

async_hooks:
  * add AsyncResource.bind utility (James M Snell) (#34574)
buffer:
  * also alias BigUInt methods (Anna Henningsen) (#34960)
  * alias UInt ➡️ Uint in buffer methods (Anna Henningsen) (#34729)
build:
  * add build flag for OSS-Fuzz integration (davkor) (#34761)
cli:
  * add alias for report-directory to make it consistent (Ash Cripps) (#33587)
crypto:
  * allow KeyObjects in postMessage (Tobias Nießen) (#33360)
  * add randomInt function (Oli Lalonde) (#34600)
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) (#34915)
dgram:
  * add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) (#14500)
  * allow typed arrays in .send() (Sarat Addepalli) (#22413)
doc:
  * add basic embedding example documentation (Anna Henningsen) (#30467)
embedding:
  * make Stop() stop Workers (Anna Henningsen) (#32531)
  * provide hook for custom process.exit() behaviour (Anna Henningsen) (#32531)
fs:
  * implement lutimes (Maël Nison) (#33399)
http:
  * return this from IncomingMessage#destroy() (Colin Ihrig) (#32789)
  * expose host and protocol on ClientRequest (wenningplus) [#33803](#33803)
http2:
  * return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) (#33994)
  * do not modify explicity set date headers (Pranshu Srivastava) (#33160)
* n-api**:
  * support type-tagging objects (Gabriel Schulhof) (#28237)
  * provide asynchronous cleanup hooks (Anna Henningsen) (#34572)
perf_hooks:
  * add idleTime and event loop util (Trevor Norris) (#34938)
timers:
  * allow timers to be used as primitives (Denys Otrishko) [#34017](#34017)
tls:
  * make 'createSecureContext' honor more options (Mateusz Krawczuk) (#33974)
worker:
  * add public method for marking objects as untransferable (Anna Henningsen) (#33979)
  * emit `'messagerror'` events for failed deserialization (Anna Henningsen) (#33772)
  * allow passing JS wrapper objects via postMessage (Anna Henningsen) (#33772)
  * allow transferring/cloning generic BaseObjects (Anna Henningsen) (#33772)
  * add option to track unmanaged file descriptors (Anna Henningsen) (#34303)
  * add stack size resource limit option (Anna Henningsen) (#33085)
  * make FileHandle transferable (Anna Henningsen) (#33772)
zlib:
  * add `maxOutputLength` option (unknown) (#33516)

PR-URL: TODO
@codebytere codebytere mentioned this pull request Sep 28, 2020
codebytere added a commit that referenced this pull request Oct 1, 2020
Notable changes:

async_hooks:
  * add AsyncResource.bind utility (James M Snell) (#34574)
buffer:
  * also alias BigUInt methods (Anna Henningsen) (#34960)
  * alias UInt ➡️ Uint in buffer methods (Anna Henningsen) (#34729)
build:
  * add build flag for OSS-Fuzz integration (davkor) (#34761)
cli:
  * add alias for report-directory to make it consistent (Ash Cripps) (#33587)
crypto:
  * allow KeyObjects in postMessage (Tobias Nießen) (#33360)
  * add randomInt function (Oli Lalonde) (#34600)
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) (#34915)
dgram:
  * add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) (#14500)
  * allow typed arrays in .send() (Sarat Addepalli) (#22413)
doc:
  * add basic embedding example documentation (Anna Henningsen) (#30467)
embedding:
  * make Stop() stop Workers (Anna Henningsen) (#32531)
  * provide hook for custom process.exit() behaviour (Anna Henningsen) (#32531)
fs:
  * implement lutimes (Maël Nison) (#33399)
http:
  * return this from IncomingMessage#destroy() (Colin Ihrig) (#32789)
  * expose host and protocol on ClientRequest (wenningplus) [#33803](#33803)
http2:
  * return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) (#33994)
  * do not modify explicity set date headers (Pranshu Srivastava) (#33160)
* n-api**:
  * support type-tagging objects (Gabriel Schulhof) (#28237)
  * provide asynchronous cleanup hooks (Anna Henningsen) (#34572)
perf_hooks:
  * add idleTime and event loop util (Trevor Norris) (#34938)
timers:
  * allow timers to be used as primitives (Denys Otrishko) [#34017](#34017)
tls:
  * make 'createSecureContext' honor more options (Mateusz Krawczuk) (#33974)
worker:
  * add public method for marking objects as untransferable (Anna Henningsen) (#33979)
  * emit `'messagerror'` events for failed deserialization (Anna Henningsen) (#33772)
  * allow passing JS wrapper objects via postMessage (Anna Henningsen) (#33772)
  * allow transferring/cloning generic BaseObjects (Anna Henningsen) (#33772)
  * add option to track unmanaged file descriptors (Anna Henningsen) (#34303)
  * add stack size resource limit option (Anna Henningsen) (#33085)
  * make FileHandle transferable (Anna Henningsen) (#33772)
zlib:
  * add `maxOutputLength` option (unknown) (#33516)

PR-URL: TODO
codebytere added a commit that referenced this pull request Oct 4, 2020
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) #31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) #34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) #34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) #34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) #34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) #33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) #33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) #34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) #34915
  * upgrade npm to 6.14.7 (claudiahdz) #34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) #34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) #14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) #22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) #33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) #30467
  * add Ricky Zhou to collaborators (rickyes) #34676
  * add release key for Ruy Adorno (Ruy Adorno) #34628
  * add DerekNonGeneric to collaborators (Derek Lewis) #34602
  * add AshCripps to collaborators (Ash Cripps) #34494
  * add HarshithaKP to collaborators (Harshitha K P) #34417
  * add rexagod to collaborators (Pranshu Srivastava) #34457
  * add release key for Richard Lau (Richard Lau) #34397
  * add danielleadams to collaborators (Danielle Adams) #34360
  * add sxa as collaborator (Stewart X Addison) #34338
  * add ruyadorno to collaborators (Ruy Adorno) #34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) #32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) #32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) #32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) #33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) #33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) #32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) #33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) #33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) #33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) #35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) #34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) #34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) #32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) #35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) #28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) #34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) #34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) #34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) #33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) #33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) #33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) #34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) #33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) #33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) #33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) #34048

PR-URL: TODO
codebytere added a commit that referenced this pull request Oct 6, 2020
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) #31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) #34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) #34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) #34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) #34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) #33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) #33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) #34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) #34915
  * upgrade npm to 6.14.7 (claudiahdz) #34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) #34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) #14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) #22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) #33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) #30467
  * add Ricky Zhou to collaborators (rickyes) #34676
  * add release key for Ruy Adorno (Ruy Adorno) #34628
  * add DerekNonGeneric to collaborators (Derek Lewis) #34602
  * add AshCripps to collaborators (Ash Cripps) #34494
  * add HarshithaKP to collaborators (Harshitha K P) #34417
  * add rexagod to collaborators (Pranshu Srivastava) #34457
  * add release key for Richard Lau (Richard Lau) #34397
  * add danielleadams to collaborators (Danielle Adams) #34360
  * add sxa as collaborator (Stewart X Addison) #34338
  * add ruyadorno to collaborators (Ruy Adorno) #34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) #32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) #32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) #32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) #33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) #33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) #32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) #33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) #33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) #33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) #35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) #34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) #34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) #32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) #35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) #28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) #34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) #34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) #34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) #33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) #33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) #33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) #34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) #33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) #33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) #33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) #34048

PR-URL: TODO
codebytere added a commit that referenced this pull request Oct 6, 2020
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) #31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) #34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) #34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) #34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) #34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) #33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) #33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) #34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) #34915
  * upgrade npm to 6.14.7 (claudiahdz) #34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) #34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) #14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) #22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) #33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) #30467
  * add Ricky Zhou to collaborators (rickyes) #34676
  * add release key for Ruy Adorno (Ruy Adorno) #34628
  * add DerekNonGeneric to collaborators (Derek Lewis) #34602
  * add AshCripps to collaborators (Ash Cripps) #34494
  * add HarshithaKP to collaborators (Harshitha K P) #34417
  * add rexagod to collaborators (Pranshu Srivastava) #34457
  * add release key for Richard Lau (Richard Lau) #34397
  * add danielleadams to collaborators (Danielle Adams) #34360
  * add sxa as collaborator (Stewart X Addison) #34338
  * add ruyadorno to collaborators (Ruy Adorno) #34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) #32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) #32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) #32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) #33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) #33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) #32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) #33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) #33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) #33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) #35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) #34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) #34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) #32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) #35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) #28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) #34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) #34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) #34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) #33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) #33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) #33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) #34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) #33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) #33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) #33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) #34048

PR-URL: TODO
codebytere added a commit that referenced this pull request Oct 6, 2020
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) #31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) #34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) #34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) #34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) #34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) #33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) #33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) #34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) #34915
  * upgrade npm to 6.14.7 (claudiahdz) #34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) #34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) #14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) #22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) #33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) #30467
  * add Ricky Zhou to collaborators (rickyes) #34676
  * add release key for Ruy Adorno (Ruy Adorno) #34628
  * add DerekNonGeneric to collaborators (Derek Lewis) #34602
  * add AshCripps to collaborators (Ash Cripps) #34494
  * add HarshithaKP to collaborators (Harshitha K P) #34417
  * add rexagod to collaborators (Pranshu Srivastava) #34457
  * add release key for Richard Lau (Richard Lau) #34397
  * add danielleadams to collaborators (Danielle Adams) #34360
  * add sxa as collaborator (Stewart X Addison) #34338
  * add ruyadorno to collaborators (Ruy Adorno) #34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) #32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) #32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) #32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) #33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) #33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) #32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) #33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) #33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) #33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) #35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) #34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) #34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) #32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) #35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) #28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) #34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) #34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) #34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) #33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) #33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) #33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) #34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) #33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) #33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) #33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) #34048

PR-URL: #35401
codebytere added a commit that referenced this pull request Oct 6, 2020
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) #31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) #34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) #34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) #34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) #34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) #33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) #33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) #34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) #34915
  * upgrade npm to 6.14.7 (claudiahdz) #34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) #34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) #14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) #22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) #33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) #30467
  * add Ricky Zhou to collaborators (rickyes) #34676
  * add release key for Ruy Adorno (Ruy Adorno) #34628
  * add DerekNonGeneric to collaborators (Derek Lewis) #34602
  * add AshCripps to collaborators (Ash Cripps) #34494
  * add HarshithaKP to collaborators (Harshitha K P) #34417
  * add rexagod to collaborators (Pranshu Srivastava) #34457
  * add release key for Richard Lau (Richard Lau) #34397
  * add danielleadams to collaborators (Danielle Adams) #34360
  * add sxa as collaborator (Stewart X Addison) #34338
  * add ruyadorno to collaborators (Ruy Adorno) #34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) #32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) #32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) #32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) #33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) #33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) #32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) #33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) #33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) #33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) #35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) #34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) #34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) #32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) #35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) #28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) #34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) #34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) #34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) #33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) #33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) #33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) #33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) #34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) #33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) #33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) #33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) #34048

PR-URL: #35401
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Notable changes:

assert:
  * (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) nodejs#31982
async_hooks:
  * (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) nodejs#34574
buffer:
  * (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) nodejs#34960
  * (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) nodejs#34729
build:
  * (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) nodejs#34761
cli:
  * (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) nodejs#33587
crypto:
  * (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) nodejs#33360
  * (SEMVER-MINOR) add randomInt function (Oli Lalonde) nodejs#34600
deps:
  * upgrade to libuv 1.39.0 (Colin Ihrig) nodejs#34915
  * upgrade npm to 6.14.7 (claudiahdz) nodejs#34468
  * upgrade to libuv 1.38.1 (Colin Ihrig) nodejs#34187
dgram:
  * (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) nodejs#14500
  * (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) nodejs#22413
doc:
  * (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) nodejs#33617
  * (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) nodejs#30467
  * add Ricky Zhou to collaborators (rickyes) nodejs#34676
  * add release key for Ruy Adorno (Ruy Adorno) nodejs#34628
  * add DerekNonGeneric to collaborators (Derek Lewis) nodejs#34602
  * add AshCripps to collaborators (Ash Cripps) nodejs#34494
  * add HarshithaKP to collaborators (Harshitha K P) nodejs#34417
  * add rexagod to collaborators (Pranshu Srivastava) nodejs#34457
  * add release key for Richard Lau (Richard Lau) nodejs#34397
  * add danielleadams to collaborators (Danielle Adams) nodejs#34360
  * add sxa as collaborator (Stewart X Addison) nodejs#34338
  * add ruyadorno to collaborators (Ruy Adorno) nodejs#34297
  * (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) nodejs#32499
embedding:
  * (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) nodejs#32531
  * (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) nodejs#32531
fs:
  * (SEMVER-MINOR) implement lutimes (Maël Nison) nodejs#33399
http:
  * (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) nodejs#33617
  * (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) nodejs#32789
  * (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) nodejs#33803
http2:
  * (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) nodejs#33994
  * (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) nodejs#33160
module:
  * (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) nodejs#35249
  * (SEMVER-MINOR) exports pattern support (Guy Bedford) nodejs#34718
  * (SEMVER-MINOR) package "imports" field (Guy Bedford) nodejs#34117
  * (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) nodejs#32217
n-api:
  * (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) nodejs#35199
  * (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) nodejs#28237
n-api,src:
  * (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) nodejs#34572
perf_hooks:
  * (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) nodejs#34938
timers:
  * (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) nodejs#34017
tls:
  * (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) nodejs#33974
worker:
  * (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) nodejs#33979
  * (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) nodejs#33772
  * (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) nodejs#33772
  * (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) nodejs#33772
  * (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) nodejs#34303
  * (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) nodejs#33085
worker,fs:
  * (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) nodejs#33772
zlib:
  * (SEMVER-MINOR) add `maxOutputLength` option (unknown) nodejs#33516
  * switch to lazy init for zlib streams (Andrey Pechkurov) nodejs#34048

PR-URL: nodejs#35401
addaleax added a commit that referenced this pull request Feb 18, 2021
This reverts commit 037ac99.

As flaky CI failures have revealed, this feature was implemented
incorrectly. `stop_sub_worker_contexts()` needs to be called on the
thread on which the `Environment` is currently running, it’s not
thread-safe. The current API requires `Stop()` to be thread-safe,
though.

We could add a new API for this, but unless there’s demand, that’s
probably not necessary as `FreeEnvironment()` will also stop Workers,
which is commonly the next action on an `Environment` instance after
having `Stop()` called on it.

Refs: #32531

PR-URL: #32623
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
addaleax added a commit that referenced this pull request Feb 18, 2021
This adds a regression test for terminating a Worker inside which
another Worker is running.

PR-URL: #32623
Refs: #32531
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
richardlau pushed a commit that referenced this pull request Feb 22, 2021
This reverts commit 037ac99.

As flaky CI failures have revealed, this feature was implemented
incorrectly. `stop_sub_worker_contexts()` needs to be called on the
thread on which the `Environment` is currently running, it’s not
thread-safe. The current API requires `Stop()` to be thread-safe,
though.

We could add a new API for this, but unless there’s demand, that’s
probably not necessary as `FreeEnvironment()` will also stop Workers,
which is commonly the next action on an `Environment` instance after
having `Stop()` called on it.

Refs: #32531

PR-URL: #32623
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
richardlau pushed a commit that referenced this pull request Feb 22, 2021
This adds a regression test for terminating a Worker inside which
another Worker is running.

PR-URL: #32623
Refs: #32531
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. embedding Issues and PRs related to embedding Node.js in another project. lib / src Issues and PRs related to general changes in the lib or src directory. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants