Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
bf7b94f
tools: refactor checkimports.py
VoltrexKeyva Oct 15, 2023
943047e
deps: V8: cherry-pick 25902244ad1a
joyeecheung Oct 15, 2023
f3a9ea0
stream: call helper function from push and unshift
rluvaton Oct 15, 2023
5df3d5a
tools: update comment in `update-uncidi.sh` and `acorn_version.h`
Oct 15, 2023
ae905a8
test: fix defect path traversal tests
tniessen Oct 16, 2023
1f40ca1
doc: update security release process
mhdawson Oct 12, 2023
47633ab
doc: add loong64 to list of architectures
shipujin Oct 16, 2023
789372a
stream: allow pass stream class to `stream.compose`
himself65 Oct 14, 2023
06b7724
doc: add command to keep major branch sync
RafaelGSS Oct 16, 2023
bac872c
doc: update release-stewards with last sec-release
RafaelGSS Oct 16, 2023
b6021ab
lib: reduce overhead of blob clone
H4ad Oct 17, 2023
a54179f
vm: unify host-defined option generation in vm.compileFunction
joyeecheung Oct 5, 2023
3999362
vm: use internal versions of compileFunction and Script
joyeecheung Oct 11, 2023
dda33c2
vm: reject in importModuleDynamically without --experimental-vm-modules
joyeecheung Oct 5, 2023
571f7ef
deps: patch V8 to 11.8.172.15
targos Oct 17, 2023
514ac86
stream: reduce scope of readable bitmap details
ronag Oct 17, 2023
3729e33
doc: add H4ad to collaborators
H4ad Oct 17, 2023
8c1a46c
doc: fix H4ad collaborator sort
H4ad Oct 17, 2023
82363be
doc: fix typo in dgram docs
missinglink Oct 18, 2023
18862e4
fs: add flush option to appendFile() functions
cjihrig Oct 18, 2023
143ddde
test: set sea snapshot tests as flaky
anonrig Oct 18, 2023
7740bf8
esm: rename error code related to import attributes
aduh95 Oct 18, 2023
c76eb27
esm: improve check for ESM syntax
GeoffreyBooth Oct 18, 2023
8efb75f
test: set `test-runner-watch-mode` as flaky
anonrig Oct 18, 2023
a38d131
test: set test-worker-nearheaplimit-deadlock flaky
StefanStojanovic Oct 18, 2023
610036c
fs: improve error performance of `renameSync`
anonrig Sep 29, 2023
f766c04
fs: improve error performance of `chownSync`
anonrig Sep 29, 2023
81f1527
fs: improve error performance of `linkSync`
anonrig Sep 29, 2023
2759878
fs: improve error performance of `mkdtempSync`
anonrig Sep 29, 2023
bc6f279
fs: improve error performance of `readlinkSync`
anonrig Sep 29, 2023
dc9ac8d
fs: improve error performance of `symlinkSync`
anonrig Sep 29, 2023
6eeaa02
fs: improve error performance of `lchownSync`
anonrig Sep 29, 2023
c5ff000
fs: improve error performance of `realpathSync`
anonrig Oct 1, 2023
dd66fdf
test: set parallel http server test as flaky
anonrig Oct 18, 2023
dacee4d
doc: add ReflectConstruct to known perf issues
H4ad Oct 18, 2023
3e38001
test: skip test-benchmark-os.js on IBM i
abmusse Oct 17, 2023
ce27ee7
tls: reduce TLS 'close' event listener warnings
pimterry Oct 18, 2023
c874490
test: set inspector async hook test as flaky
anonrig Oct 18, 2023
7c6e4d7
test: set `test-esm-loader-resolve-type` as flaky
anonrig Oct 19, 2023
ce9d84e
doc: update api `stream.compose`
himself65 Oct 19, 2023
0c710da
test: improve code coverage of diagnostics_channel
MrJithil Oct 19, 2023
317e447
test: deflake `test-loaders-workers-spawned`
aduh95 Oct 18, 2023
9cd68b9
buffer: remove unnecessary assignment in fromString
tniessen Oct 19, 2023
9bc5ab5
test: set `test-structuredclone-*` as flaky
anonrig Oct 19, 2023
be19d9b
meta: move Trott to TSC regular member
Trott Oct 19, 2023
5129bed
test: set crypto-timing test as flaky
anonrig Oct 20, 2023
2473aa3
doc: fix release process table of contents
richardlau Oct 20, 2023
c55f8f3
test: reduce the number of requests and parsers
lpinca Oct 20, 2023
3f8cbb1
http2: allow streams to complete gracefully after goaway
murgatroid99 Oct 20, 2023
21a6ba5
test: set `test-cli-node-options` as flaky
anonrig Oct 19, 2023
6507f66
test: set test-worker-nearheaplimit-deadlock flaky
StefanStojanovic Oct 19, 2023
57adbdd
test: set inspector async stack test as flaky
anonrig Oct 18, 2023
3b80a68
test: set `test-emit-after-on-destroyed` as flaky
anonrig Oct 20, 2023
e375063
esm: detect ESM syntax in ambiguous JavaScript
GeoffreyBooth Oct 20, 2023
a362c27
crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey
panva Oct 20, 2023
5a52c51
lib: add `navigator.userAgent`
anonrig Oct 20, 2023
465ad2a
test: update `url` web platform tests
anonrig Oct 20, 2023
6ec5aba
fs: improve error performance for `mkdirSync`
CanadaHonk Oct 20, 2023
5942edb
fs: improve error performance for `fsyncSync`
Oct 20, 2023
ba258b6
deps: update c-ares to 1.20.0
nodejs-github-bot Oct 8, 2023
f050668
deps: update c-ares to 1.20.1
nodejs-github-bot Oct 11, 2023
0cc176e
fs: improve error performance for `readSync`
Oct 21, 2023
5dc454a
util: remove internal mime fns from benchmarks
Uzlopak Oct 21, 2023
af31d51
test: replace forEach with for..of in test-http2-client-destroy.js
niyashiyas Oct 21, 2023
2d8d6c5
test: replace forEach with for..of in test-http2-server
niyashiyas Sep 23, 2023
19d3ce2
test: deflake `test-esm-loader-resolve-type`
aduh95 Oct 21, 2023
67c599e
test: replace forEach with for..of in test-net-isipv4.js
niyashiyas Oct 21, 2023
4d390e2
test: replace forEach with for..of in test-http-perf_hooks.js
niyashiyas Sep 23, 2023
ab4bae8
tools: drop support for osx notarization with gon
UlisesGascon Oct 21, 2023
7f87084
Revert "test: set `test-esm-loader-resolve-type` as flaky"
aduh95 Oct 21, 2023
1c21a18
doc: update release process LTS step
richardlau Oct 21, 2023
c40de82
doc: add loong64 info into platform list
shipujin Oct 22, 2023
0005317
deps: update undici to 5.26.4
nodejs-github-bot Oct 22, 2023
531a3ae
stream: simplify prefinish
ronag Oct 22, 2023
63b7059
test: set `test-watch-mode-inspect` as flaky
anonrig Oct 22, 2023
1464eba
lib: improve performance of validateStringArray and validateBooleanArray
Uzlopak Oct 22, 2023
87be790
worker: handle detached `MessagePort` from a different context
juanarbol Oct 22, 2023
6e537ae
doc: explain how to disable navigator
GeoffreyBooth Oct 22, 2023
03a31ce
deps: update corepack to 0.22.0
nodejs-github-bot Oct 24, 2023
91e373f
node-api: return napi_exception_pending on proxy handlers
legendecas Jun 15, 2023
a9ca7b3
test: improve watch mode test
MoLow Oct 23, 2023
8f7eb15
vm: use import attributes instead of import assertions
aduh95 Oct 23, 2023
db2a1cf
doc: fix `navigator.hardwareConcurrency` example
tniessen Oct 23, 2023
269e268
deps: update ada to 2.7.2
nodejs-github-bot Oct 23, 2023
998feda
esm: do not give wrong hints when detecting file format
aduh95 Oct 23, 2023
f4da308
deps: V8: cherry-pick f7d000a7ae7b
lukealbao Oct 23, 2023
f4e5beb
2023-10-24, Version 21.1.0 (Current)
targos Oct 23, 2023
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: handle detached MessagePort from a different context
When `worker.moveMessagePortToContext` is used, the async handle
associated with the port, will be triggered more than needed (at least
one more time) and with null data. That can be avoided by simply
checking that the data is present and the port is not detached.

Fixes: #49075
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #49150
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
juanarbol authored and targos committed Oct 23, 2023
commit 87be790fa92522c34b53e50eb5891ed7ec02fdf0
7 changes: 7 additions & 0 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,13 @@ MaybeLocal<Value> MessagePort::ReceiveMessage(Local<Context> context,

void MessagePort::OnMessage(MessageProcessingMode mode) {
Debug(this, "Running MessagePort::OnMessage()");
// Maybe the async handle was triggered empty or more than needed.
// The data_ could be freed or, the handle has been/is being closed.
// A possible case for this, is transfer the MessagePort to another
// context, it will call the constructor and trigger the async handle empty.
// Because all data was sent from the preivous context.
if (IsDetached()) return;

HandleScope handle_scope(env()->isolate());
Local<Context> context =
object(env()->isolate())->GetCreationContext().ToLocalChecked();
Expand Down
30 changes: 28 additions & 2 deletions test/parallel/test-worker-workerdata-messageport.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

require('../common');
const assert = require('assert');
const assert = require('node:assert');

const {
Worker, MessageChannel
} = require('worker_threads');
} = require('node:worker_threads');

const channel = new MessageChannel();
const workerData = { mesage: channel.port1 };
Expand Down Expand Up @@ -61,3 +61,29 @@ const meowScript = () => 'meow';
'listed in transferList'
});
}

{
// Should not crash when MessagePort is transferred to another context.
// https://github.com/nodejs/node/issues/49075
const channel = new MessageChannel();
new Worker(`
const { runInContext, createContext } = require('node:vm')
const { workerData } = require('worker_threads');
const context = createContext(Object.create(null));
context.messagePort = workerData.messagePort;
runInContext(
\`messagePort.postMessage("Meow")\`,
context,
{ displayErrors: true }
);
`, {
eval: true,
workerData: { messagePort: channel.port2 },
transferList: [channel.port2]
});
channel.port1.on(
'message',
(message) =>
assert.strictEqual(message, 'Meow')
);
}