-
Notifications
You must be signed in to change notification settings - Fork 5k
node:worker_threads: per-thread --use-system-ca, real eventLoopUtilization, --cpu-prof in workers, node's online timing, error.code / stack-getter / timeOrigin fixes, async_hooks WORKER resource, worker_threads dc channel (+10 upstream tests) #34424
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
Open
cirospaciari
wants to merge
80
commits into
main
Choose a base branch
from
ciro/worker-threads-node-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,022
−240
Open
Changes from 10 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
7f82a21
node:worker_threads: add 5 upstream Node worker tests that already pass
cirospaciari f69da29
node:worker_threads: add 3 more upstream Node worker tests that alrea…
cirospaciari 356f936
node:worker_threads: drop test-worker-dns-terminate, exempt fshandles…
cirospaciari f57c53b
node:worker_threads: exempt both fshandles tests from LeakSanitizer
cirospaciari 2872f8f
node:worker_threads: drop the two fshandles tests instead of exemptin…
cirospaciari c8a6e90
worker_threads: publish node's 'worker_threads' diagnostics channel
cirospaciari 10fe341
worker_threads: async_hooks WORKER resource, error-clone stack, share…
cirospaciari c308af4
BroadcastChannel: ref() should return the channel
cirospaciari f1384cd
worker_threads: fire 'online' before the entry point runs, as node does
cirospaciari 5056973
Merge origin/main into ciro/worker-threads-node-tests
cirospaciari d7e1659
worker_threads: address review feedback and drop test-worker-memory
robobun c7d3e81
cli: support node's -pe alias
cirospaciari 80aae50
worker_threads: profile worker threads under --cpu-prof
cirospaciari e61bfa4
cli: scope the -pe alias to the bun/node entry points in execArgv
robobun 4f599cf
[autofix.ci] apply automated fixes
autofix-ci[bot] fb8b3d3
cpu profiler: clamp the sampling interval to a usable range
cirospaciari dbe27a0
tls: make --use-system-ca a per-Environment option, add --no-use-syst…
cirospaciari 0fe453a
[autofix.ci] apply automated fixes
autofix-ci[bot] e20129c
cpu profiler: do not inherit --cpu-prof-name into workers
robobun 3a09c2e
[autofix.ci] apply automated fixes
autofix-ci[bot] fc01f2f
worker_threads: keep error.code when the thrown value cannot be cloned
cirospaciari 57cf856
perf_hooks: implement eventLoopUtilization()
cirospaciari dfe31cd
[autofix.ci] apply automated fixes
autofix-ci[bot] aba81dd
cpu profiler: let workers inherit --cpu-prof-name, as node does
cirospaciari 74c1ebf
[autofix.ci] apply automated fixes
autofix-ci[bot] f17365c
fix lint and clippy fallout from the eventLoopUtilization work
cirospaciari 997ce14
address review: once() this-binding, init sites, nested cpu-prof, lint
robobun e19fa93
Merge branch 'main' into ciro/worker-threads-node-tests
cirospaciari 1fbc0d1
eventLoopUtilization: fix two cross-thread races
robobun 19b36ff
eventLoopUtilization: use seq_cst for the idle_ns/idle_entry_ns pair
robobun c7cfb4e
web_worker: fix two aliasing/race hazards in the cross-thread ELU/cpu…
robobun f0f5e8e
[autofix.ci] apply automated fixes
autofix-ci[bot] de70866
ci: retrigger
robobun 31fb9fc
epoll_kqueue: hoist the post-park clock read before zeroing idle_entr…
robobun a757b03
Worker.cpp: guard errorCodeOf against a pending TerminationException
robobun 46f9f32
Merge branch 'main' into ciro/worker-threads-node-tests
cirospaciari 1efb86f
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
robobun 89e5f6e
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
robobun 747cbbb
trim comments to <=3 lines, cite spec/node source
robobun 79b3862
Worker.cpp: guard WebWorker__dispatchError/dispatchErrorWithValue aga…
robobun 388af0e
bun_get_loop_elu: use raw us_loop_idle_ns, drop the &self idle_ns wra…
robobun 134c6b0
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
robobun 5e6f3ac
Merge branch 'main' into ciro/worker-threads-node-tests
cirospaciari fb72372
web_worker: don't report a terminate()-rejected entry promise as unca…
robobun f99b7c0
Add missing SAFETY comment on us_loop_idle_ns call
cirospaciari 20f5734
web_worker: close the Bun-side termination-exception holes in the ter…
robobun 04dca3c
worker: keep flush_logs and teardown termination-safe on the remainin…
cirospaciari a4993b9
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
robobun 5d77db6
Merge branch 'main' into ciro/worker-threads-node-tests
cirospaciari 3b28311
execArgv: drop the unconditional -pe insertion the merge reintroduced
robobun 49f1a4f
Trim comments to node-source/spec references
robobun 7d70027
Skip worker_destruction under ASAN while the terminate-during-load as…
robobun c6045a8
worker_destruction: terminate when the worker reports its action started
robobun 3288369
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
dylan-conway bc4eab3
worker_threads: read a Worker's hasRef / loop utilization through pri…
dylan-conway f3c28b8
Reattach release_parent_poll_ref doc comment to its function
robobun 8c4567d
Drop unreachable keep-alive guard in WorkerMessagingProxy::hasRef
robobun 94db9ae
worker_threads: honour --cpu-prof-dir, --cpu-prof-name and --cpu-prof…
dylan-conway fec0b60
perf_hooks: eventLoopUtilization needs no null-loop guard
dylan-conway 47cceef
tls: a Worker's --use-system-ca / --no-use-system-ca governs the root…
dylan-conway e5e73b0
Merge remote-tracking branch 'origin/main' into ciro/worker-threads-n…
dylan-conway 153e900
Fix two review findings in the per-worker use-system-ca plumbing
robobun e7f89fd
Only install OpenSSL default cert paths in the system-CA store variant
robobun ab623d0
Merge branch 'main' into ciro/worker-threads-node-tests
cirospaciari dc6b8bb
tls.getCACertificates('default') reports the decision connections use
robobun 6222f4d
root_certs: cite node's NewRootCertStore for the default-paths gating
robobun 6ab78d8
Restore per-thread NODE_USE_SYSTEM_CA fallback in getCACertificates
robobun 28ea0a8
worker_threads: apply the thread's --use-system-ca to the default cli…
cirospaciari bb88250
worker_threads: resolve a flagless thread's CA option from its env, r…
cirospaciari 6fc1c9d
tls/worker_threads: keep OpenSSL's default lookups in the flagless st…
cirospaciari efc5781
tls: back to node's root-store rules; make --use-openssl-ca exclusive
cirospaciari 8eb5f3e
uws: safety comment on us_get_shared_default_ca_store matches its arg…
robobun 9d5b413
tls.getCACertificates('default') leaves bundled and system roots out …
robobun ef0dc09
tls/worker_threads: system store is the OS store alone, openssl-ca re…
cirospaciari b6f0c62
Pin the web Worker 'open' event to thread start, ahead of the entry p…
robobun a24ad08
web_worker: borrow the ELU atomics directly (clippy deref_addrof)
cirospaciari 3fcfde3
Point the use_system_ca_flag docs at InitOptions; arm the ELU test's …
robobun da612ae
Merge branch 'main' into ciro/worker-threads-node-tests
alii 09f3e89
bake: init the production VM as the main thread like its siblings
robobun 7e37ca0
bake: pass the CA flag explicitly instead of initializing as the main…
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/js/node/test/parallel/test-diagnostics-channel-worker-threads.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const { Worker } = require('worker_threads'); | ||
| const dc = require('diagnostics_channel'); | ||
|
|
||
| dc.subscribe('worker_threads', common.mustCall(({ worker }) => { | ||
| assert.strictEqual(worker instanceof Worker, true); | ||
| })); | ||
|
|
||
| new Worker('const a = 1;', { eval: true }); |
20 changes: 20 additions & 0 deletions
20
test/js/node/test/parallel/test-perf-hooks-worker-timeorigin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 'use strict'; | ||
|
|
||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const { Worker } = require('worker_threads'); | ||
|
|
||
| const w = new Worker(` | ||
| require('worker_threads').parentPort.postMessage(performance.timeOrigin); | ||
| `, { eval: true }); | ||
|
|
||
| w.on('message', common.mustCall((timeOrigin) => { | ||
| // PerformanceNodeTiming exposes process milestones so the | ||
| // `performance.timeOrigin` in the `worker_threads.Worker` must be the start | ||
| // time of the process. | ||
| assert.strictEqual(timeOrigin, performance.timeOrigin); | ||
| })); | ||
|
|
||
| w.on('exit', common.mustCall((code) => { | ||
| assert.strictEqual(code, 0); | ||
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| 'use strict'; | ||
| const common = require('../common'); | ||
|
|
||
| const assert = require('assert'); | ||
| const fs = require('fs'); | ||
| const { Server } = require('net'); | ||
| const { Worker, isMainThread, parentPort } = require('worker_threads'); | ||
|
|
||
| if (isMainThread) { | ||
| const w = new Worker(__filename); | ||
| let fd = null; | ||
| w.on('message', common.mustCall((fd_) => { | ||
| assert.strictEqual(typeof fd_, 'number'); | ||
| fd = fd_; | ||
| })); | ||
| w.on('exit', common.mustCall(() => { | ||
| if (fd === -1) { | ||
| // This happens when server sockets don’t have file descriptors, | ||
| // i.e. on Windows. | ||
| return; | ||
| } | ||
| assert.throws(() => fs.fstatSync(fd), { code: 'EBADF' }); | ||
| })); | ||
| } else { | ||
| const server = new Server(); | ||
| server.listen(0); | ||
| parentPort.postMessage(server._handle.fd); | ||
| server.unref(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import * as common from '../common/index.mjs'; | ||
| import { Worker } from 'node:worker_threads'; | ||
|
|
||
| { | ||
| // Verifies that the worker is async disposable | ||
| await using worker = new Worker('for(;;) {}', { eval: true }); | ||
| worker.on('exit', common.mustCall()); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.