Giter VIP home page Giter VIP logo

Comments (5)

theanarkh avatar theanarkh commented on June 10, 2024 2

Maybe we can ignore the invalid args when the execArgv is inherited from parent ? Only throw an error when the user pass execArgv explicitly, like here.

from node.

nicolo-ribaudo avatar nicolo-ribaudo commented on June 10, 2024 1

If "execArgv must always be passed otherwise your worker might break" is intentional, then:

  • it shouldn't be affected by whether the env: {} option is passed or not
  • Node.js should probably warn when not passing execArgv, as a library might pass tests but it cannot control what CLI options the app that it's used into uses

The docs say that "By default, options are inherited from the parent thread". The behavior before #52827 was (when defining env) that process-wide options are inherited and thread-local options are not. The new behavior is that thread-local options are inherited, and process-wide options just crash.

Neither of the two behaviors seem ideal and neither matches the docs (when env is defined), but broken for broken it's better to keep the old broken to avoid breaking existing code.

When not passing env, both thread-local and process-wide options are inherited.

or filter forbidden cli options from parent thread and pass it into worker options 🤷

Node.js doesn't expose a list of options that are forbidden, so it's impossible to do so (see #52827)

from node.

nicolo-ribaudo avatar nicolo-ribaudo commented on June 10, 2024

Would it be possible to revert #52827 until a better fix is found? (i.e. the worker should just ignore unsupported argv that are passed implicitly rather than explicitly, or argv should be filtered before being passed to the worker)

from node.

bricss avatar bricss commented on June 10, 2024

It seems like this behavior is quite intentional, as per docs:

execArgv <string[]> List of node CLI options passed to the worker. V8 options (such as --max-old-space-size) and options that affect the process (such as --title) are not supported. If set, this is provided as process.execArgv inside the worker. By default, options are inherited from the parent thread.

And a simple workaround is to add execArgv: [] to the worker's options 🕵️ or filter forbidden cli options from parent thread and pass it into worker options 🤷

from node.

bricss avatar bricss commented on June 10, 2024

How about adding some code to fix this by filtering out unwanted cli options by default? 🤔

from node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.