From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Wed, 1 May 2024 14:24:48 +0200 Subject: cli: move --trace-atomics-wait to eol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52747 Fixes: https://github.com/nodejs/node/issues/42982 Reviewed-By: Matteo Collina Reviewed-By: Rafael Gonzaga Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Yagiz Nizipli diff --git a/doc/api/cli.md b/doc/api/cli.md index 431a6aa7a2cf4d537cb719f15c2749254e0433b3..1d1672a01c4fae6b339cb144d0d6e35b49209a14 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -32,11 +32,11 @@ is passed. If no corresponding file is found, an error is thrown. If a file is found, its path will be passed to the [ES module loader][Modules loaders] under any of the following conditions: -* The program was started with a command-line flag that forces the entry +- The program was started with a command-line flag that forces the entry point to be loaded with ECMAScript module loader, such as `--import` or [`--experimental-default-type=module`][]. -* The file has an `.mjs` extension. -* The file does not have a `.cjs` extension, and the nearest parent +- The file has an `.mjs` extension. +- The file does not have a `.cjs` extension, and the nearest parent `package.json` file contains a top-level [`"type"`][] field with a value of `"module"`. @@ -164,7 +164,10 @@ Example: ```js const childProcess = require('node:child_process'); // Attempt to bypass the permission -childProcess.spawn('node', ['-e', 'require("fs").writeFileSync("/new-file", "example")']); +childProcess.spawn('node', [ + '-e', + 'require("fs").writeFileSync("/new-file", "example")', +]); ``` ```console @@ -206,8 +209,8 @@ the [Permission Model][]. The valid arguments for the `--allow-fs-read` flag are: -* `*` - To allow all `FileSystemRead` operations. -* Multiple paths can be allowed using multiple `--allow-fs-read` flags. +- `*` - To allow all `FileSystemRead` operations. +- Multiple paths can be allowed using multiple `--allow-fs-read` flags. Example `--allow-fs-read=/folder1/ --allow-fs-read=/folder1/` Examples can be found in the [File System Permissions][] documentation. @@ -251,8 +254,8 @@ the [Permission Model][]. The valid arguments for the `--allow-fs-write` flag are: -* `*` - To allow all `FileSystemWrite` operations. -* Multiple paths can be allowed using multiple `--allow-fs-write` flags. +- `*` - To allow all `FileSystemWrite` operations. +- Multiple paths can be allowed using multiple `--allow-fs-write` flags. Example `--allow-fs-write=/folder1/ --allow-fs-write=/folder1/` Paths delimited by comma (`,`) are no longer allowed. @@ -399,10 +402,10 @@ creation behavior. The following options are currently supported: -* `builder` {string} Required. Provides the name to the script that is executed +- `builder` {string} Required. Provides the name to the script that is executed before building the snapshot, as if [`--build-snapshot`][] had been passed with `builder` as the main script name. -* `withoutCodeCache` {boolean} Optional. Including the code cache reduces the +- `withoutCodeCache` {boolean} Optional. Including the code cache reduces the time spent on compiling functions included in the snapshot at the expense of a bigger snapshot size and potentially breaking portability of the snapshot. @@ -550,9 +553,9 @@ Defaults to current working directory. Affects the default output directory of: -* [`--cpu-prof-dir`][] -* [`--heap-prof-dir`][] -* [`--redirect-warnings`][] +- [`--cpu-prof-dir`][] +- [`--heap-prof-dir`][] +- [`--redirect-warnings`][] ### `--disable-proto=mode` @@ -697,9 +700,9 @@ changes: Set the default value of `order` in [`dns.lookup()`][] and [`dnsPromises.lookup()`][]. The value could be: -* `ipv4first`: sets default `order` to `ipv4first`. -* `ipv6first`: sets default `order` to `ipv6first`. -* `verbatim`: sets default `order` to `verbatim`. +- `ipv4first`: sets default `order` to `ipv4first`. +- `ipv6first`: sets default `order` to `ipv6first`. +- `verbatim`: sets default `order` to `verbatim`. The default is `verbatim` and [`dns.setDefaultResultOrder()`][] have higher priority than `--dns-result-order`. @@ -890,7 +893,7 @@ added: v22.7.0 > Stability: 1 - Experimental Enables the use of [`AsyncLocalStorage`][] backed by `AsyncContextFrame` rather -than the default implementation which relies on async\_hooks. This new model is +than the default implementation which relies on async_hooks. This new model is implemented very differently and so could have differences in how context data flows within the application. As such, it is presently recommended to be sure your application behaviour is unaffected by this change before using it in @@ -909,12 +912,12 @@ added: Define which module system, `module` or `commonjs`, to use for the following: -* String input provided via `--eval` or STDIN, if `--input-type` is unspecified. +- String input provided via `--eval` or STDIN, if `--input-type` is unspecified. -* Files ending in `.js` or with no extension, if there is no `package.json` file +- Files ending in `.js` or with no extension, if there is no `package.json` file present in the same folder or any parent folder. -* Files ending in `.js` or with no extension, if the nearest parent +- Files ending in `.js` or with no extension, if the nearest parent `package.json` field lacks a `"type"` field; unless the `package.json` folder or any parent folder is inside a `node_modules` folder. @@ -1450,15 +1453,15 @@ interoperability with non-conformant HTTP implementations. When enabled, the parser will accept the following: -* Invalid HTTP headers values. -* Invalid HTTP versions. -* Allow message containing both `Transfer-Encoding` +- Invalid HTTP headers values. +- Invalid HTTP versions. +- Allow message containing both `Transfer-Encoding` and `Content-Length` headers. -* Allow extra data after message when `Connection: close` is present. -* Allow extra transfer encodings after `chunked` has been provided. -* Allow `\n` to be used as token separator instead of `\r\n`. -* Allow `\r\n` not to be provided after a chunk. -* Allow spaces to be present after a chunk size and before `\r\n`. +- Allow extra data after message when `Connection: close` is present. +- Allow extra transfer encodings after `chunked` has been provided. +- Allow `\n` to be used as token separator instead of `\r\n`. +- Allow `\r\n` not to be provided after a chunk. +- Allow spaces to be present after a chunk size and before `\r\n`. All the above will expose your application to request smuggling or poisoning attack. Avoid using this option. @@ -1536,8 +1539,8 @@ a [remote code execution][] attack. If specifying a host, make sure that either: -* The host is not accessible from public networks. -* A firewall disallows unwanted connections on the port. +- The host is not accessible from public networks. +- A firewall disallows unwanted connections on the port. **More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by default) is not firewall-protected.** @@ -1799,7 +1802,7 @@ added: --> Enable OpenSSL 3.0 legacy provider. For more information please see -[OSSL\_PROVIDER-legacy][OSSL_PROVIDER-legacy]. +[OSSL_PROVIDER-legacy][OSSL_PROVIDER-legacy]. ### `--openssl-shared-config` @@ -1849,12 +1852,12 @@ changes: Enable the Permission Model for current process. When enabled, the following permissions are restricted: -* File System - manageable through +- File System - manageable through [`--allow-fs-read`][], [`--allow-fs-write`][] flags -* Child Process - manageable through [`--allow-child-process`][] flag -* Worker Threads - manageable through [`--allow-worker`][] flag -* WASI - manageable through [`--allow-wasi`][] flag -* Addons - manageable through [`--allow-addons`][] flag +- Child Process - manageable through [`--allow-child-process`][] flag +- Worker Threads - manageable through [`--allow-worker`][] flag +- WASI - manageable through [`--allow-wasi`][] flag +- Addons - manageable through [`--allow-addons`][] flag ### `--preserve-symlinks` @@ -2194,16 +2197,16 @@ cases. Some features of other `run` implementations that are intentionally excluded are: -* Running `pre` or `post` scripts in addition to the specified script. -* Defining package manager-specific environment variables. +- Running `pre` or `post` scripts in addition to the specified script. +- Defining package manager-specific environment variables. #### Environment variables The following environment variables are set when running a script with `--run`: -* `NODE_RUN_SCRIPT_NAME`: The name of the script being run. For example, if +- `NODE_RUN_SCRIPT_NAME`: The name of the script being run. For example, if `--run` is used to run `test`, the value of this variable will be `test`. -* `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being +- `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being processed. ### `--secure-heap-min=n` @@ -2601,39 +2604,6 @@ added: v12.0.0 Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support for TLSv1.2, which is not as secure as TLSv1.3. -### `--trace-atomics-wait` - - - -> Stability: 0 - Deprecated - -Print short summaries of calls to [`Atomics.wait()`][] to stderr. -The output could look like this: - -```text -(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started -(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched -(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started -(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out -(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started -(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started -(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread -(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread -``` - -The fields here correspond to: - -* The thread id as given by [`worker_threads.threadId`][] -* The base address of the `SharedArrayBuffer` in question, as well as the - byte offset corresponding to the index passed to `Atomics.wait()` -* The expected value that was passed to `Atomics.wait()` -* The timeout passed to `Atomics.wait` - ### `--trace-deprecation` -* `--allow-addons` -* `--allow-child-process` -* `--allow-fs-read` -* `--allow-fs-write` -* `--allow-wasi` -* `--allow-worker` -* `--conditions`, `-C` -* `--diagnostic-dir` -* `--disable-proto` -* `--disable-sigusr1` -* `--disable-warning` -* `--disable-wasm-trap-handler` -* `--dns-result-order` -* `--enable-fips` -* `--enable-network-family-autoselection` -* `--enable-source-maps` -* `--entry-url` -* `--experimental-abortcontroller` -* `--experimental-async-context-frame` -* `--experimental-default-type` -* `--experimental-detect-module` -* `--experimental-eventsource` -* `--experimental-import-meta-resolve` -* `--experimental-json-modules` -* `--experimental-loader` -* `--experimental-modules` -* `--experimental-permission` -* `--experimental-print-required-tla` -* `--experimental-require-module` -* `--experimental-shadow-realm` -* `--experimental-specifier-resolution` -* `--experimental-strip-types` -* `--experimental-top-level-await` -* `--experimental-transform-types` -* `--experimental-vm-modules` -* `--experimental-wasi-unstable-preview1` -* `--experimental-wasm-modules` -* `--experimental-webstorage` -* `--force-context-aware` -* `--force-fips` -* `--force-node-api-uncaught-exceptions-policy` -* `--frozen-intrinsics` -* `--heap-prof-dir` -* `--heap-prof-interval` -* `--heap-prof-name` -* `--heap-prof` -* `--heapsnapshot-near-heap-limit` -* `--heapsnapshot-signal` -* `--http-parser` -* `--icu-data-dir` -* `--import` -* `--input-type` -* `--insecure-http-parser` -* `--inspect-brk` -* `--inspect-port`, `--debug-port` -* `--inspect-publish-uid` -* `--inspect-wait` -* `--inspect` -* `--localstorage-file` -* `--max-http-header-size` -* `--napi-modules` -* `--network-family-autoselection-attempt-timeout` -* `--no-addons` -* `--no-deprecation` -* `--no-experimental-fetch` -* `--no-experimental-global-customevent` -* `--no-experimental-global-navigator` -* `--no-experimental-global-webcrypto` -* `--no-experimental-repl-await` -* `--no-experimental-sqlite` -* `--no-experimental-websocket` -* `--no-extra-info-on-fatal-exception` -* `--no-force-async-hooks-checks` -* `--no-global-search-paths` -* `--no-network-family-autoselection` -* `--no-warnings` -* `--node-memory-debug` -* `--openssl-config` -* `--openssl-legacy-provider` -* `--openssl-shared-config` -* `--pending-deprecation` -* `--permission` -* `--preserve-symlinks-main` -* `--preserve-symlinks` -* `--prof-process` -* `--redirect-warnings` -* `--report-compact` -* `--report-dir`, `--report-directory` -* `--report-exclude-env` -* `--report-exclude-network` -* `--report-filename` -* `--report-on-fatalerror` -* `--report-on-signal` -* `--report-signal` -* `--report-uncaught-exception` -* `--require`, `-r` -* `--secure-heap-min` -* `--secure-heap` -* `--snapshot-blob` -* `--test-coverage-branches` -* `--test-coverage-exclude` -* `--test-coverage-functions` -* `--test-coverage-include` -* `--test-coverage-lines` -* `--test-name-pattern` -* `--test-only` -* `--test-reporter-destination` -* `--test-reporter` -* `--test-shard` -* `--test-skip-pattern` -* `--throw-deprecation` -* `--title` -* `--tls-cipher-list` -* `--tls-keylog` -* `--tls-max-v1.2` -* `--tls-max-v1.3` -* `--tls-min-v1.0` -* `--tls-min-v1.1` -* `--tls-min-v1.2` -* `--tls-min-v1.3` -* `--trace-atomics-wait` -* `--trace-deprecation` -* `--trace-env-js-stack` -* `--trace-env-native-stack` -* `--trace-env` -* `--trace-event-categories` -* `--trace-event-file-pattern` -* `--trace-events-enabled` -* `--trace-exit` -* `--trace-require-module` -* `--trace-sigint` -* `--trace-sync-io` -* `--trace-tls` -* `--trace-uncaught` -* `--trace-warnings` -* `--track-heap-objects` -* `--unhandled-rejections` -* `--use-bundled-ca` -* `--use-largepages` -* `--use-openssl-ca` -* `--v8-pool-size` -* `--watch-path` -* `--watch-preserve-output` -* `--watch` -* `--zero-fill-buffers` +- `--allow-addons` +- `--allow-child-process` +- `--allow-fs-read` +- `--allow-fs-write` +- `--allow-wasi` +- `--allow-worker` +- `--conditions`, `-C` +- `--diagnostic-dir` +- `--disable-proto` +- `--disable-sigusr1` +- `--disable-warning` +- `--disable-wasm-trap-handler` +- `--dns-result-order` +- `--enable-fips` +- `--enable-network-family-autoselection` +- `--enable-source-maps` +- `--entry-url` +- `--experimental-abortcontroller` +- `--experimental-async-context-frame` +- `--experimental-default-type` +- `--experimental-detect-module` +- `--experimental-eventsource` +- `--experimental-import-meta-resolve` +- `--experimental-json-modules` +- `--experimental-loader` +- `--experimental-modules` +- `--experimental-permission` +- `--experimental-print-required-tla` +- `--experimental-require-module` +- `--experimental-shadow-realm` +- `--experimental-specifier-resolution` +- `--experimental-strip-types` +- `--experimental-top-level-await` +- `--experimental-transform-types` +- `--experimental-vm-modules` +- `--experimental-wasi-unstable-preview1` +- `--experimental-wasm-modules` +- `--experimental-webstorage` +- `--force-context-aware` +- `--force-fips` +- `--force-node-api-uncaught-exceptions-policy` +- `--frozen-intrinsics` +- `--heap-prof-dir` +- `--heap-prof-interval` +- `--heap-prof-name` +- `--heap-prof` +- `--heapsnapshot-near-heap-limit` +- `--heapsnapshot-signal` +- `--http-parser` +- `--icu-data-dir` +- `--import` +- `--input-type` +- `--insecure-http-parser` +- `--inspect-brk` +- `--inspect-port`, `--debug-port` +- `--inspect-publish-uid` +- `--inspect-wait` +- `--inspect` +- `--localstorage-file` +- `--max-http-header-size` +- `--napi-modules` +- `--network-family-autoselection-attempt-timeout` +- `--no-addons` +- `--no-deprecation` +- `--no-experimental-fetch` +- `--no-experimental-global-customevent` +- `--no-experimental-global-navigator` +- `--no-experimental-global-webcrypto` +- `--no-experimental-repl-await` +- `--no-experimental-sqlite` +- `--no-experimental-websocket` +- `--no-extra-info-on-fatal-exception` +- `--no-force-async-hooks-checks` +- `--no-global-search-paths` +- `--no-network-family-autoselection` +- `--no-warnings` +- `--node-memory-debug` +- `--openssl-config` +- `--openssl-legacy-provider` +- `--openssl-shared-config` +- `--pending-deprecation` +- `--permission` +- `--preserve-symlinks-main` +- `--preserve-symlinks` +- `--prof-process` +- `--redirect-warnings` +- `--report-compact` +- `--report-dir`, `--report-directory` +- `--report-exclude-env` +- `--report-exclude-network` +- `--report-filename` +- `--report-on-fatalerror` +- `--report-on-signal` +- `--report-signal` +- `--report-uncaught-exception` +- `--require`, `-r` +- `--secure-heap-min` +- `--secure-heap` +- `--snapshot-blob` +- `--test-coverage-branches` +- `--test-coverage-exclude` +- `--test-coverage-functions` +- `--test-coverage-include` +- `--test-coverage-lines` +- `--test-name-pattern` +- `--test-only` +- `--test-reporter-destination` +- `--test-reporter` +- `--test-shard` +- `--test-skip-pattern` +- `--throw-deprecation` +- `--title` +- `--tls-cipher-list` +- `--tls-keylog` +- `--tls-max-v1.2` +- `--tls-max-v1.3` +- `--tls-min-v1.0` +- `--tls-min-v1.1` +- `--tls-min-v1.2` +- `--tls-min-v1.3` +- `--trace-deprecation` +- `--trace-env-js-stack` +- `--trace-env-native-stack` +- `--trace-env` +- `--trace-event-categories` +- `--trace-event-file-pattern` +- `--trace-events-enabled` +- `--trace-exit` +- `--trace-require-module` +- `--trace-sigint` +- `--trace-sync-io` +- `--trace-tls` +- `--trace-uncaught` +- `--trace-warnings` +- `--track-heap-objects` +- `--unhandled-rejections` +- `--use-bundled-ca` +- `--use-largepages` +- `--use-openssl-ca` +- `--v8-pool-size` +- `--watch-path` +- `--watch-preserve-output` +- `--watch` +- `--zero-fill-buffers` @@ -3266,19 +3235,19 @@ V8 options that are allowed are: -* `--abort-on-uncaught-exception` -* `--disallow-code-generation-from-strings` -* `--enable-etw-stack-walking` -* `--expose-gc` -* `--interpreted-frames-native-stack` -* `--jitless` -* `--max-old-space-size` -* `--max-semi-space-size` -* `--perf-basic-prof-only-functions` -* `--perf-basic-prof` -* `--perf-prof-unwinding-info` -* `--perf-prof` -* `--stack-trace-limit` +- `--abort-on-uncaught-exception` +- `--disallow-code-generation-from-strings` +- `--enable-etw-stack-walking` +- `--expose-gc` +- `--interpreted-frames-native-stack` +- `--jitless` +- `--max-old-space-size` +- `--max-semi-space-size` +- `--perf-basic-prof-only-functions` +- `--perf-basic-prof` +- `--perf-prof-unwinding-info` +- `--perf-prof` +- `--stack-trace-limit` @@ -3446,23 +3415,12 @@ and the line lengths of the source file (in the key `lineLengths`). "url": "./path-to-map.json", "data": { "version": 3, - "sources": [ - "file:///absolute/path/to/original.js" - ], - "names": [ - "Foo", - "console", - "info" - ], + "sources": ["file:///absolute/path/to/original.js"], + "names": ["Foo", "console", "info"], "mappings": "MAAMA,IACJC,YAAaC", "sourceRoot": "./" }, - "lineLengths": [ - 13, - 62, - 38, - 27 - ] + "lineLengths": [13, 62, 38, 27] } } } @@ -3470,7 +3428,7 @@ and the line lengths of the source file (in the key `lineLengths`). ### `NO_COLOR=` -[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the +[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the environment variable is arbitrary. ### `OPENSSL_CONF=file` @@ -3552,12 +3510,12 @@ Asynchronous system APIs are used by Node.js whenever possible, but where they do not exist, libuv's threadpool is used to create asynchronous node APIs based on synchronous system APIs. Node.js APIs that use the threadpool are: -* all `fs` APIs, other than the file watcher APIs and those that are explicitly +- all `fs` APIs, other than the file watcher APIs and those that are explicitly synchronous -* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, +- asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, `crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()` -* `dns.lookup()` -* all `zlib` APIs, other than those that are explicitly synchronous +- `dns.lookup()` +- all `zlib` APIs, other than those that are explicitly synchronous Because libuv's threadpool has a fixed size, it means that if for whatever reason any of these APIs takes a long time, other (seemingly unrelated) APIs @@ -3723,7 +3681,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 [`--redirect-warnings`]: #--redirect-warningsfile [`--require`]: #-r---require-module [`AsyncLocalStorage`]: async_context.md#class-asynclocalstorage -[`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait [`Buffer`]: buffer.md#class-buffer [`CRYPTO_secure_malloc_init`]: https://www.openssl.org/docs/man3.0/man3/CRYPTO_secure_malloc_init.html [`ERR_INVALID_TYPESCRIPT_SYNTAX`]: errors.md#err_invalid_typescript_syntax @@ -3746,7 +3703,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 [`tls.DEFAULT_MIN_VERSION`]: tls.md#tlsdefault_min_version [`unhandledRejection`]: process.md#event-unhandledrejection [`v8.startupSnapshot` API]: v8.md#startup-snapshot-api -[`worker_threads.threadId`]: worker_threads.md#workerthreadid [collecting code coverage from tests]: test.md#collecting-code-coverage [conditional exports]: packages.md#conditional-exports [context-aware]: addons.md#context-aware-addons diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 0df7dce60058d518c9607094344461b60e540e60..f5f8ac77c848edf62b0a82f0644f61077a02aedd 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3313,6 +3313,9 @@ Values other than `undefined`, `null`, integer numbers, and integer strings -Type: Runtime +Type: End-of-Life -The [`--trace-atomics-wait`][] flag is deprecated because +The `--trace-atomics-wait` flag has been removed because it uses the V8 hook `SetAtomicsWaitCallback`, that will be removed in a future V8 release. @@ -3737,7 +3740,6 @@ deprecated, as their values are guaranteed to be identical to that of `process.f [`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy [`--pending-deprecation`]: cli.md#--pending-deprecation [`--throw-deprecation`]: cli.md#--throw-deprecation -[`--trace-atomics-wait`]: cli.md#--trace-atomics-wait [`--unhandled-rejections`]: cli.md#--unhandled-rejectionsmode [`Buffer.allocUnsafeSlow(size)`]: buffer.md#static-method-bufferallocunsafeslowsize [`Buffer.from(array)`]: buffer.md#static-method-bufferfromarray diff --git a/doc/node.1 b/doc/node.1 index 9f534746ef9d9c1c1ee2edd6c195573a2e228600..e01fc511a1034518c0fb9bc5fa925524aecad927 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -533,11 +533,6 @@ but the option is supported for compatibility with older Node.js versions. Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in favour of TLSv1.3, which is more secure. . -.It Fl -trace-atomics-wait -Print short summaries of calls to -.Sy Atomics.wait() . -. -This flag is deprecated. .It Fl -trace-deprecation Print stack traces for deprecations. . diff --git a/src/node.cc b/src/node.cc index 0ed78ab6b52906e980eebf1f625a1c7cbfc8097b..2ff08a9cb6124316049a91bda70cf6985045286a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -226,44 +226,6 @@ void Environment::WaitForInspectorFrontendByOptions() { } #endif // HAVE_INSPECTOR -#define ATOMIC_WAIT_EVENTS(V) \ - V(kStartWait, "started") \ - V(kWokenUp, "was woken up by another thread") \ - V(kTimedOut, "timed out") \ - V(kTerminatedExecution, "was stopped by terminated execution") \ - V(kAPIStopped, "was stopped through the embedder API") \ - V(kNotEqual, "did not wait because the values mismatched") \ - -static void AtomicsWaitCallback(Isolate::AtomicsWaitEvent event, - Local array_buffer, - size_t offset_in_bytes, int64_t value, - double timeout_in_ms, - Isolate::AtomicsWaitWakeHandle* stop_handle, - void* data) { - Environment* env = static_cast(data); - - const char* message = "(unknown event)"; - switch (event) { -#define V(key, msg) \ - case Isolate::AtomicsWaitEvent::key: \ - message = msg; \ - break; - ATOMIC_WAIT_EVENTS(V) -#undef V - } - - fprintf(stderr, - "(node:%d) [Thread %" PRIu64 "] Atomics.wait(%p + %zx, %" PRId64 - ", %.f) %s\n", - static_cast(uv_os_getpid()), - env->thread_id(), - array_buffer->Data(), - offset_in_bytes, - value, - timeout_in_ms, - message); -} - void Environment::InitializeDiagnostics() { isolate_->GetHeapProfiler()->AddBuildEmbedderGraphCallback( Environment::BuildEmbedderGraph, this); @@ -272,17 +234,6 @@ void Environment::InitializeDiagnostics() { } if (options_->trace_uncaught) isolate_->SetCaptureStackTraceForUncaughtExceptions(true); - if (options_->trace_atomics_wait) { - ProcessEmitDeprecationWarning( - Environment::GetCurrent(isolate_), - "The flag --trace-atomics-wait is deprecated.", - "DEP0165"); - isolate_->SetAtomicsWaitCallback(AtomicsWaitCallback, this); - AddCleanupHook([](void* data) { - Environment* env = static_cast(data); - env->isolate()->SetAtomicsWaitCallback(nullptr, nullptr); - }, this); - } if (options_->trace_promises) { isolate_->SetPromiseHook(TracePromises); } diff --git a/src/node_options.cc b/src/node_options.cc index 866f2a39a5e51a8bf434ccd54d76c685bcdd1502..2bedaa88582c369a4a420ff20a5204af96feb52e 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -758,10 +758,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "throw an exception on deprecations", &EnvironmentOptions::throw_deprecation, kAllowedInEnvvar); - AddOption("--trace-atomics-wait", - "(deprecated) trace Atomics.wait() operations", - &EnvironmentOptions::trace_atomics_wait, - kAllowedInEnvvar); AddOption("--trace-deprecation", "show stack traces on deprecations", &EnvironmentOptions::trace_deprecation, diff --git a/src/node_options.h b/src/node_options.h index 41dd04f5e2b1cd54c32df70830389d44d7b39aa2..b10287d3eadc49b44e2e3fb8150a48be6866b0b4 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -203,7 +203,6 @@ class EnvironmentOptions : public Options { std::vector coverage_include_pattern; std::vector coverage_exclude_pattern; bool throw_deprecation = false; - bool trace_atomics_wait = false; bool trace_deprecation = false; bool trace_exit = false; bool trace_sync_io = false; diff --git a/test/parallel/test-trace-atomic-deprecation.js b/test/parallel/test-trace-atomic-deprecation.js deleted file mode 100644 index 8aeddb28e938d23e646d882cfe24b2e2311f9ab2..0000000000000000000000000000000000000000 --- a/test/parallel/test-trace-atomic-deprecation.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('node:assert'); -const { test } = require('node:test'); - -test('should emit deprecation warning DEP0165', async () => { - const { code, stdout, stderr } = await common.spawnPromisified( - process.execPath, ['--trace-atomics-wait', '-e', '{}'] - ); - assert.match(stderr, /\[DEP0165\] DeprecationWarning:/); - assert.strictEqual(stdout, ''); - assert.strictEqual(code, 0); -}); diff --git a/test/parallel/test-trace-atomics-wait.js b/test/parallel/test-trace-atomics-wait.js deleted file mode 100644 index 6449a2be2b47e0758090dc13d136877b1874c635..0000000000000000000000000000000000000000 --- a/test/parallel/test-trace-atomics-wait.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; -require('../common'); -const assert = require('assert'); -const child_process = require('child_process'); -const { Worker } = require('worker_threads'); - -if (process.argv[2] === 'child') { - const i32arr = new Int32Array(new SharedArrayBuffer(8)); - assert.strictEqual(Atomics.wait(i32arr, 0, 1), 'not-equal'); - assert.strictEqual(Atomics.wait(i32arr, 0, 0, 10), 'timed-out'); - - new Worker(` - const i32arr = require('worker_threads').workerData; - Atomics.store(i32arr, 1, -1); - Atomics.notify(i32arr, 1); - Atomics.wait(i32arr, 1, -1); - `, { eval: true, workerData: i32arr }); - - Atomics.wait(i32arr, 1, 0); - assert.strictEqual(Atomics.load(i32arr, 1), -1); - Atomics.store(i32arr, 1, 0); - Atomics.notify(i32arr, 1); - return; -} - -const proc = child_process.spawnSync( - process.execPath, - [ '--disable-warning=DEP0165', '--trace-atomics-wait', __filename, 'child' ], - { encoding: 'utf8', stdio: [ 'inherit', 'inherit', 'pipe' ] }); - -if (proc.status !== 0) console.log(proc); -assert.strictEqual(proc.status, 0); - -const SABAddress = proc.stderr.match(/Atomics\.wait\((?.+) \+/).groups.SAB; -const actualTimeline = proc.stderr - .replace(new RegExp(SABAddress, 'g'), '
') - .replace(new RegExp(`\\(node:${proc.pid}\\) `, 'g'), '') - .replace(/\binf(inity)?\b/gi, 'inf') - .replace(/\r/g, '') - .trim(); -console.log('+++ normalized stdout +++'); -console.log(actualTimeline); -console.log('--- normalized stdout ---'); - -const begin = -`[Thread 0] Atomics.wait(
+ 0, 1, inf) started -[Thread 0] Atomics.wait(
+ 0, 1, inf) did not wait because the \ -values mismatched -[Thread 0] Atomics.wait(
+ 0, 0, 10) started -[Thread 0] Atomics.wait(
+ 0, 0, 10) timed out`; - -const expectedTimelines = [ - `${begin} -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, - `${begin} -[Thread 1] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, -1, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, - `${begin} -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, - `${begin} -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ -values mismatched`, - `${begin} -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ -values mismatched`, - `${begin} -[Thread 1] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, -1, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread -[Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ -values mismatched`, - `${begin} -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) did not wait because the \ -values mismatched -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ -values mismatched`, - `${begin} -[Thread 1] Atomics.wait(
+ 4, -1, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) started -[Thread 0] Atomics.wait(
+ 4, 0, inf) did not wait because the \ -values mismatched -[Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, -]; - -assert(expectedTimelines.includes(actualTimeline));