Skip to content

(experimental) worker isolation #24947

Description

@FranckFreiburger
  • Version: 11.3.0
  • Platform:win 7 (64)
  • Subsystem:

I just wondering if this lack of isolation is expected:

new Worker(`process.env.FOO = 123`, { eval: true });
new Worker(`console.log(process.env.FOO)`, { eval: true }); // prints 123

Activity

  1. added
    questionIssues asking questions about Node.js.
    workerIssues and PRs related to the worker_threads module and Worker API.
    docIssues and PRs related to Node.js documentation.
    and removed
    questionIssues asking questions about Node.js.
    on Dec 10, 2018
  2. addaleax commented on Dec 10, 2018

    @addaleax
    Member

    I think at the very least the documentation does not match the actual behaviour here… I think in an earlier version of the workers implementation, we did what the doc states (not allow modifications from worker threads), but it seems that right now we also allow write access?

    /cc @nodejs/workers

  3. devsnek commented on Dec 10, 2018

    @devsnek
    Member

    i prefer the documented behaviour

  4. FranckFreiburger commented on Dec 10, 2018

    @FranckFreiburger
    Author

    @addaleax, is this behavior thread-safe ?

  5. addaleax commented on Dec 10, 2018

    @addaleax
    Member

    @FranckFreiburger We access the environment variables with a mutex, both for reading and for writing, so this should be okay (at least as far as Node is concerned). But like @devsnek, I think I’d prefer the documented behaviour.

  6. joyeecheung commented on Dec 10, 2018

    @joyeecheung
    Member

    So this is a regression? (trying to apply labels)

  7. addaleax commented on Dec 10, 2018

    @addaleax
    Member

    @joyeecheung This behaviour (and the wrong docs) have been present since workers have first been released; I assume these checks went lost during a rebase or similar… so I don’t think it’s a regression, it’s just a bug?

  8. removed
    docIssues and PRs related to Node.js documentation.
    on Dec 10, 2018
  9. sagitsofan commented on Dec 22, 2018

    @sagitsofan
    Contributor

    @addaleax I will pick this one.
    Should the appropriate solution needs to block the write access to process.env and emit a warning / exception ?

  10. addaleax commented on Dec 22, 2018

    @addaleax
    Member

    @sagitsofan I don’t think we want a warning or exception; rather, not installing the setters for process.env should be the most JavaScript-y solution here, I think?

  11. sagitsofan commented on Dec 22, 2018

    @sagitsofan
    Contributor

    @addaleax But if we silently will not install the setters of process.env the user will think this operation have done successfully, isn't it? shouldn't a warning is the appropriate way?

  12. 30 remaining items

  13. added a commit that references this issue on Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.workerIssues and PRs related to the worker_threads module and Worker API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions