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

[v11.x] enable workers by default #25404

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion benchmark/misc/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
mode: ['process', 'worker']
}, {
flags: ['--expose-internals', '--experimental-worker'] // for workers
flags: ['--expose-internals']
});

function spawnProcess(script) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/worker/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
n: [1e5]
}, { flags: ['--experimental-worker'] });
});

const workerPath = path.resolve(__dirname, '..', 'fixtures', 'echo.worker.js');

Expand Down
8 changes: 0 additions & 8 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ added: v9.6.0

Enable experimental ES Module support in the `vm` module.

### `--experimental-worker`
<!-- YAML
added: v10.5.0
-->

Enable experimental worker threads using the `worker_threads` module.

### `--force-fips`
<!-- YAML
added: v6.0.0
Expand Down Expand Up @@ -604,7 +597,6 @@ Node.js options that are allowed are:
- `--experimental-modules`
- `--experimental-repl-await`
- `--experimental-vm-modules`
- `--experimental-worker`
- `--force-fips`
- `--icu-data-dir`
- `--inspect`
Expand Down
2 changes: 1 addition & 1 deletion doc/api/worker_threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

The `worker` module provides a way to create multiple environments running
on independent threads, and to create message channels between them. It
can be accessed using the `--experimental-worker` flag and:
can be accessed using:

```js
const worker = require('worker_threads');
Expand Down
3 changes: 0 additions & 3 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ keyword support in REPL.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.
.It Fl -experimental-worker
Enable experimental worker threads using worker_threads module.
.
.It Fl -force-fips
Force FIPS-compliant crypto on startup
(Cannot be disabled from script code).
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class EnvironmentOptions : public Options {
bool experimental_modules = false;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool experimental_worker = false;
bool experimental_worker = true;
bool expose_internals = false;
std::string http_parser =
#ifdef NODE_EXPERIMENTAL_HTTP_DEFAULT
Expand Down
3 changes: 1 addition & 2 deletions test/abort/test-addon-uv-handle-leak.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ if (process.argv[2] === 'child') {
binding.leakHandle(0x42);
`, { eval: true });
} else {
const child = cp.spawnSync(process.execPath,
['--experimental-worker', __filename, 'child']);
const child = cp.spawnSync(process.execPath, [__filename, 'child']);
const stderr = child.stderr.toString();

assert.strictEqual(child.stdout.toString(), '');
Expand Down
1 change: 0 additions & 1 deletion test/addons/hello-world/test-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
Expand Down
2 changes: 0 additions & 2 deletions test/addons/worker-addon/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
Expand All @@ -11,7 +10,6 @@ if (process.argv[2] === 'child') {
new Worker(`require(${JSON.stringify(binding)});`, { eval: true });
} else {
const proc = child_process.spawnSync(process.execPath, [
'--experimental-worker',
__filename,
'child'
]);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-async-wrap-missing-method.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-heapdump-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
'use strict';
require('../common');
const { validateSnapshotNodes } = require('../common/heap');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-module-cjs-helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-trace-events-api-worker-disabled.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
4 changes: 1 addition & 3 deletions test/parallel/test-trace-events-worker-metadata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand All @@ -15,8 +14,7 @@ if (isMainThread) {
process.chdir(tmpdir.path);

const proc = cp.spawn(process.execPath,
[ '--experimental-worker',
'--trace-event-categories', 'node',
[ '--trace-event-categories', 'node',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(fs.existsSync(FILE_NAME));
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-v8-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function nextdir() {
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
const output = spawnSync(process.execPath, [
'--experimental-worker',
require.resolve('../fixtures/v8-coverage/worker')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-cleanup-handles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
5 changes: 2 additions & 3 deletions test/parallel/test-worker-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

Expand Down Expand Up @@ -154,9 +153,9 @@ async function testBasicWorkerDebug(session, post) {
await workerSession.post('Debugger.enable');
await workerSession.post('Runtime.enable');
await workerSession.waitForBreakAfterCommand(
'Runtime.runIfWaitingForDebugger', __filename, 2);
'Runtime.runIfWaitingForDebugger', __filename, 1);
await workerSession.waitForBreakAfterCommand(
'Debugger.resume', __filename, 27); // V8 line number is zero-based
'Debugger.resume', __filename, 26); // V8 line number is zero-based
assert.strictEqual(await consolePromise, workerMessage);
workerSession.post('Debugger.resume');
await Promise.all([worker, detached, contextEvents]);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-dns-terminate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-esmodule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-modules
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-exit-code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-invalid-workerdata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-memory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-channel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-arraybuffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-drain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-closed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-self.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-transfer-target.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port-wasm-module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-message-port-wasm-threads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-wasm-threads
// Flags: --experimental-wasm-threads
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-message-port.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const { Worker, MessageChannel } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-nexttick-terminate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-onmessage-not-a-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// listener from holding the event loop open. This test confirms that
// functionality.

// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker, parentPort } = require('worker_threads');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-onmessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-parent-port-ref.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const assert = require('assert');
const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-relative-path-double-dot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-relative-path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-stdio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-syntax-error-file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-syntax-error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-type-check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-uncaught-exception-async.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-uncaught-exception.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-unsupported-path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';

const path = require('path');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker-unsupported-things.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-worker-workerdata-sharedarraybuffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';

const common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/wpt/test-console.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const { WPTRunner } = require('../common/wpt');
Expand Down
2 changes: 1 addition & 1 deletion test/wpt/test-url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals

require('../common');
const { WPTRunner } = require('../common/wpt');
Expand Down
1 change: 0 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,6 @@ def Main():

if options.worker:
run_worker = join(workspace, "tools", "run-worker.js")
options.node_args.append('--experimental-worker')
options.node_args.append(run_worker)

shell = abspath(options.shell)
Expand Down