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

v18.1.0 release proposal #42943

Merged
merged 91 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
18ae2c3
tools: lint osx shell scripts
LiviaMedeiros Apr 14, 2022
ef5ab81
doc: fix `added:` info for `outgoingMessage.{,un}cork()`
lpinca Apr 14, 2022
2a07a9f
doc: document the 'close' and 'finish' events
lpinca Apr 14, 2022
be44b1f
test: improve test coverage of internal/blob
kuriyosh Apr 14, 2022
deb3cf4
test: remove the legacy url parser function
cola119 Apr 14, 2022
78a860a
test_runner: add initial CLI runner
cjihrig Apr 15, 2022
2f38b48
meta: move mmarchini to emeritus
mmarchini Apr 16, 2022
6b7c35e
doc: delete mdb_v8 from diagnostic tooling support tiers
tony-go Apr 16, 2022
1a7af63
src: large page attributing an id on Linux
devnexen Apr 17, 2022
294664e
deps: upgrade npm to 8.7.0
Apr 14, 2022
c50309c
doc: fix `added:` info for `outgoingMessage.writable*`
lpinca Apr 17, 2022
14893c5
meta: update AUTHORS
nodejs-github-bot Apr 17, 2022
47c0481
tools: update lint-md-dependencies
nodejs-github-bot Apr 17, 2022
93fd77a
tools: update doc to [email protected]
nodejs-github-bot Apr 17, 2022
4694f5b
async_hooks: avoid decrementing iterator after erase
dygabo Apr 17, 2022
459546b
benchmark: fix misc/startup failure
aduh95 Apr 17, 2022
d77c59d
doc: improve fragment (`:target`) anchors behavior on HTML version
aduh95 Apr 17, 2022
4c30936
doc: copyedit http.OutgoingMessage documentation
lpinca Apr 17, 2022
222b3e6
doc: close tag in n-api.md
LiviaMedeiros Apr 18, 2022
962d80b
doc: add documentation for inherited methods
lpinca Apr 18, 2022
29c8411
bootstrap: move embedded snapshot to SnapshotBuilder
joyeecheung Apr 11, 2022
6bd2420
bootstrap: use the isolate snapshot in workers
joyeecheung Apr 11, 2022
d311916
test: fix calculations in test-worker-resource-limits
joyeecheung Apr 11, 2022
025b3e7
doc: consolidate use of multiple-byte units
aduh95 Apr 19, 2022
7c97347
build: improve the format-cpp error message
RaisinTen Apr 19, 2022
c3922af
worker: add hasRef() to the handle object
RaisinTen Apr 19, 2022
46c880b
doc: clarify core modules that can be loaded without a prefix
aduh95 Apr 19, 2022
3d65a3b
doc: add `node:` prefix for all core modules
aduh95 Apr 20, 2022
b7e9dd0
src: use `node:` prefix in example
aduh95 Apr 20, 2022
5d15eb1
build: fix format-cpp
RaisinTen Apr 20, 2022
1976284
src: define fs.constants.S_IWUSR & S_IRUSR for Win
ilg-ul Apr 21, 2022
33ac027
meta: move one or more collaborators to emeritus
nodejs-github-bot Apr 18, 2022
6225370
doc: fix version history for Loaders API
aduh95 Apr 21, 2022
c32f76d
doc: fix example in assert.md
LiviaMedeiros Apr 21, 2022
8476ffb
test: use `assert.match()` instead of `assert(regex.test())`
aduh95 Apr 21, 2022
6fa080c
doc: delete heapdump from diagnostic tooling support tiers
tony-go Apr 21, 2022
d9f3f05
doc: fix outdated documentation for `family` property
aduh95 Apr 21, 2022
59da133
doc: add maintaining-webassembly.md
mhdawson Apr 8, 2022
c46e7bb
doc: add @kuriyosh to collaborators
kuriyosh Apr 22, 2022
c6c1dc5
doc: order `vm.Module` linker arguments correctly
SimenB Apr 22, 2022
b0f7c4c
lib,src: implement WebAssembly Web API
tniessen Apr 23, 2022
a19fb60
v8: export more fields in getHeapStatistics
theanarkh Apr 23, 2022
7681e60
crypto: validate `this` in all webcrypto methods and getters
panva Apr 23, 2022
f9994e2
build: improve reliability of find_python.cmd script
lpinca Apr 23, 2022
d33cbab
lib: remove experimental warning from FormData
meixg Apr 24, 2022
4050b0d
build: enable V8's shared read-only heap
targos Apr 24, 2022
494650c
src,crypto: remove uses of AllocatedBuffer from crypto_ec.cc
RaisinTen Apr 24, 2022
0e16120
errors,vm: update error and use cause
devsnek Apr 22, 2022
37364ab
test: fix flaky HTTP server tests
tniessen Apr 24, 2022
fdc6503
meta: update AUTHORS
nodejs-github-bot Apr 24, 2022
97fc00a
tools: update eslint to 8.14.0
nodejs-github-bot Apr 24, 2022
1b5856a
wasi: remove unecessary null check
mhdawson Apr 24, 2022
9b61ac2
doc: update WebAssembly strategy with Wasm Web API
tniessen Apr 25, 2022
c3c5fe7
tools: bump jsdoccomment from 0.22.1 to 0.29.0
Trott Apr 25, 2022
7b70144
test: skip test that cannot pass under --node-builtin-modules-path
GeoffreyBooth Apr 25, 2022
ad82694
lib,src: use Response URL as WebAssembly location
tniessen Apr 25, 2022
2d76f72
doc: elevate node-clinic diagnostic tier
RafaelGSS Apr 20, 2022
cd2f5a4
doc: add primordials guidelines
aduh95 May 11, 2021
48bbb73
fs: fix mkdirSync so ENOSPC is correctly reported
santigimeno Apr 26, 2022
0725064
test: fix port in net-perf_hooks
LiviaMedeiros Apr 26, 2022
2f849a4
doc: fix markdown formatting in primordials.md
tniessen Apr 27, 2022
59c07a9
test: check ecdsa psychic signature
panva Apr 27, 2022
b85a11c
test: improve lib/internal/test_runner/test.js coverage
fossamagna Apr 27, 2022
fe65996
doc: clarify guide on testing internal errors
LiviaMedeiros Apr 27, 2022
a6e1e7a
doc,test: add tests and docs for duplex.fromWeb and duplex.toWeb
ErickWendel Apr 28, 2022
336242a
errors,console: refactor to use ES2021 syntax
xtx1130 Apr 28, 2022
7fae2c9
deps: add template for generated headers
danbev Apr 5, 2022
e8734a4
deps: add note about removing asm archs
danbev Apr 14, 2022
6dc1f82
deps: remove archs/aix64-gcc
danbev Apr 9, 2022
8dc71f2
deps: remove aix-gcc architecture
danbev Apr 14, 2022
4abe987
deps: remove linux-ppc architecture
danbev Apr 14, 2022
2798929
deps: remove linux-ppc64 architecture
danbev Apr 14, 2022
1102922
deps: upgrade npm to 8.8.0
npm-robot Apr 28, 2022
37ca110
src: make --no-node-snapshot a per-process option
joyeecheung Apr 28, 2022
e15d22c
doc: initial version of security-model-strategy.md
mhdawson Apr 12, 2022
dab15f6
esm: graduate top-level-await to stable
aduh95 Apr 28, 2022
8f2b228
doc: record March 2022 security release steward
richardlau Apr 28, 2022
e313dc6
doc: http2.createServer `options` as optional
daeyeon Apr 28, 2022
227a45b
doc: remove legacy `-J` test.py option from BUILDING.md
LiviaMedeiros Apr 21, 2022
60e461c
doc: reword "test directory"
LiviaMedeiros Apr 21, 2022
e808366
src: turn SSL_CTX_new CHECK/segfault into JS exception
addaleax Apr 28, 2022
3c796f8
test: fix `parallel/test-dgram-udp6-link-local-address`
aduh95 Apr 28, 2022
a0638a2
esm: fix imports from non-file module
aduh95 Apr 29, 2022
4af0fbd
v8: export cpu_profiler_metadata_size in getHeapCodeStatistics
theanarkh Apr 29, 2022
fbda87d
test: simplify test-gc-{http-client,net}-*
lpinca Apr 19, 2022
8e0e576
test: add tests for extracting function name
cola119 May 1, 2022
718d11f
perf_hooks: return different functions in timerify
himself65 Apr 24, 2022
1e7479d
tools: update lint-md-dependencies
nodejs-github-bot May 1, 2022
bf9240a
worker: add hasRef() to MessagePort
RaisinTen May 2, 2022
2a4c826
deps: update undici to 5.1.1
targos May 2, 2022
f35f8a6
2022-05-03, Version 18.1.0 (Current)
targos May 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
worker: add hasRef() to the handle object
This should help projects like
https://github.com/mafintosh/why-is-node-running and
https://github.com/facebook/jest to detect if Worker instances are
keeping the event loop active correctly.

Fixes: #42091
Refs: mafintosh/why-is-node-running#59
Signed-off-by: Darshan Sen <[email protected]>

PR-URL: #42756
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
RaisinTen authored and targos committed Apr 28, 2022
commit c3922afa1c9acad431812a1bd45725ae3410522b
8 changes: 8 additions & 0 deletions src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ void Worker::Ref(const FunctionCallbackInfo<Value>& args) {
}
}

void Worker::HasRef(const FunctionCallbackInfo<Value>& args) {
Worker* w;
ASSIGN_OR_RETURN_UNWRAP(&w, args.This());
args.GetReturnValue().Set(w->has_ref_);
}

void Worker::Unref(const FunctionCallbackInfo<Value>& args) {
Worker* w;
ASSIGN_OR_RETURN_UNWRAP(&w, args.This());
Expand Down Expand Up @@ -842,6 +848,7 @@ void InitWorker(Local<Object> target,

env->SetProtoMethod(w, "startThread", Worker::StartThread);
env->SetProtoMethod(w, "stopThread", Worker::StopThread);
env->SetProtoMethod(w, "hasRef", Worker::HasRef);
env->SetProtoMethod(w, "ref", Worker::Ref);
env->SetProtoMethod(w, "unref", Worker::Unref);
env->SetProtoMethod(w, "getResourceLimits", Worker::GetResourceLimits);
Expand Down Expand Up @@ -905,6 +912,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(Worker::New);
registry->Register(Worker::StartThread);
registry->Register(Worker::StopThread);
registry->Register(Worker::HasRef);
registry->Register(Worker::Ref);
registry->Register(Worker::Unref);
registry->Register(Worker::GetResourceLimits);
Expand Down
1 change: 1 addition & 0 deletions src/node_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Worker : public AsyncWrap {
static void SetEnvVars(const v8::FunctionCallbackInfo<v8::Value>& args);
static void StartThread(const v8::FunctionCallbackInfo<v8::Value>& args);
static void StopThread(const v8::FunctionCallbackInfo<v8::Value>& args);
static void HasRef(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args);
static void GetResourceLimits(
Expand Down
33 changes: 33 additions & 0 deletions test/parallel/test-worker-hasref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';
const common = require('../common');

const { Worker } = require('worker_threads');
const { createHook } = require('async_hooks');
const { strictEqual } = require('assert');

let handle;

createHook({
init(asyncId, type, triggerAsyncId, resource) {
if (type === 'WORKER') {
handle = resource;
this.disable();
}
}
}).enable();

const w = new Worker('', { eval: true });

strictEqual(handle.hasRef(), true);
w.unref();
strictEqual(handle.hasRef(), false);
w.ref();
strictEqual(handle.hasRef(), true);

w.on('exit', common.mustCall((exitCode) => {
strictEqual(exitCode, 0);
strictEqual(handle.hasRef(), true);
setTimeout(common.mustCall(() => {
strictEqual(handle.hasRef(), undefined);
}), 0);
}));