Skip to content

[v22.2.0 regression] Some Worker use cases are broken #53011

@liuxingbaoyu

Description

@liuxingbaoyu

Version

v22.2.0

Platform

all

Subsystem

worker_threads

What steps will reproduce the bug?

import { Worker, isMainThread } from "worker_threads";

if (isMainThread) {
  new Worker(import.meta.filename, { env: process.env });
} else {
  console.log("Hello, world!");
}

node --expose_gc .\test.mjs

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

Hello, world!

What do you see instead?

node:internal/worker:221
      throw new ERR_WORKER_INVALID_EXEC_ARGV(this[kHandle].invalidExecArgv);
            ^

Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --expose_gc
    at new Worker (node:internal/worker:221:13)
    at file:///F:/babel/test.mjs:4:3
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:475:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5) {
  code: 'ERR_WORKER_INVALID_EXEC_ARGV'
}

Additional information

Ref: #52827
It seems that passing execArgv will cause some problems until #41103 is resolved.

I'm not sure this is a regression, but it could be an unintentional breakage and would be a bit difficult to resolve on the user side since there are no known exec argvs supported by Worker.

cc @theanarkh You may be interested!

Metadata

Metadata

Assignees

No one assigned

    Labels

    v22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.workerIssues and PRs related to Worker support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions