Skip to content

Cluster fails with NODE_OPTIONS="--inspect" #19026

Closed
@mcfedr

Description

@mcfedr
  • Version: v9.6.1
  • Platform: MacOS
  • Subsystem: Cluster

When using cluster and --inspect as cli argument it is correctly handled and each worker will use a different port, this was fixed recently by #13619

But when env var NODE_OPTIONS="--inspect" is set this logic doesn't apply and the workers will fail as they try to attach to the same port

Working:

alexander ~/dev/cluster-test $ node --inspect index.js
Debugger listening on ws://127.0.0.1:9229/e6bf8c7c-bf59-4f65-a924-ab050d5a41f3
For help see https://nodejs.org/en/docs/inspector
Debugger listening on ws://127.0.0.1:9230/a32c88e4-5e0a-4140-a648-8323d0758c15
For help see https://nodejs.org/en/docs/inspector
worker success!

Failed:

alexander ~/dev/cluster-test $ NODE_OPTIONS="--inspect" node index.js
Debugger listening on ws://127.0.0.1:9229/57f0f9f7-272e-459f-94a7-b4b48c676d9d
For help see https://nodejs.org/en/docs/inspector
Starting inspector on 127.0.0.1:9229 failed: address already in use
worker exited with error code: 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    inspectorIssues and PRs related to the V8 inspector protocol

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions