GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — child_process: special handling of process.on('message') · Issue #13913 · nodejs/node

child_process: special handling of process.on('message') #13913

New issue
Copy link
New issue
Copy link
Closed
Closed
child_process: special handling of process.on('message')#13913
Copy link
Labels
child_processIssues and PRs related to the child_process subsystem.feature requestIssues requesting new Node.js features.processIssues and PRs related to the process subsystem.

Description

@refack
refack
opened on Jun 25, 2017
Issue body actions
  • Version: *
  • Platform: *
  • Subsystem: child_process
process.on('message');

has a special meaning in the context of IPC between parent and child. The problem is a 'message' event could be triggered other code, or listened to outside of IPC context, so we can not do any special treatment for it.
I suggest adding 'IPCMessage' that only the IPC channel can trigger, and registering a listener to would fail if an IPC channel was not established.
Ref: nodejs/help#693 (comment)
[edit]
The intention is to emit both events: message for backwards compatibility, and IPCMessage for a validated IPC only events.

Reacted by Colin Ihrig and Anna Henningsen

Activity

  1. refack
    added
    child_processIssues and PRs related to the child_process subsystem.
    feature requestIssues requesting new Node.js features.
    good first issueIssues that are suitable for first-time contributors.
    processIssues and PRs related to the process subsystem.
    on Jun 25, 2017
  2. mscdex commented on Jun 25, 2017

    @mscdex
    mscdex
    on Jun 25, 2017
    Contributor
    More actions

    -1 That would unnecessarily break backwards compatibility for zero gain IMHO.

  3. refack commented on Jun 25, 2017

    @refack
    refack
    on Jun 25, 2017
    ContributorAuthor
    More actions

    -1 That would unnecessarily break backwards compatibility for zero gain IMHO.

    @mscdex I mean emit both events (with proper checks). Should not break break compatibility, and allow for an opt-in stricter/guaranteed means of IPC.

  4. ORESoftware commented on Jun 26, 2017

    @ORESoftware
    ORESoftware
    on Jun 26, 2017
    Contributor
    More actions

    @refack but couldn't some evil actor just emit IPCMessage

    process.emit('IPCMessage') even if it were not an IPC message?

    in my code, I check for properties on the message object coming back to see if it's IPC related.

  5. refack commented on Jun 26, 2017

    @refack
    refack
    on Jun 26, 2017
    ContributorAuthor
    More actions

    @refack but couldn't some evil actor just emit IPCMessage
    process.emit('IPCMessage') even if it were not an IPC message?
    in my code, I check for properties on the message object coming back to see if it's IPC related.

    As I see it the node internal code will have exclusivity on emitting IPCMessage. Probably need to inherit from EventEmitter and override the emit and the registerListener do validate IPCMessage events.
    A really "evil actor" could probably monkey patch something, but that is true for most of the API, sometimes for the better (i.e. graceful-fs)

  6. mscdex commented on Jun 26, 2017

    @mscdex
    mscdex
    on Jun 26, 2017
    Contributor
    More actions

    I still don't see any worthwhile gain coming from such changes.

  7. TimothyGu
    removed
    good first issueIssues that are suitable for first-time contributors.
    on Jun 26, 2017
  8. TimothyGu commented on Jun 26, 2017

    @TimothyGu
    TimothyGu
    on Jun 26, 2017
    Member
    More actions

    (removing "good first contribution" tag as there isn't yet a consensus)

    Reacted by Refael Ackermann
  9. bnoordhuis commented on Jun 26, 2017

    @bnoordhuis
    bnoordhuis
    on Jun 26, 2017
    Member
    More actions

    Also -1. Adds complexity and overhead for unclear benefit and feels a bit like a solution in search of a problem.

  10. refack commented on Jun 26, 2017

    @refack
    refack
    on Jun 26, 2017
    ContributorAuthor
    More actions

    Closing for lack of consensus 🤷‍♂️

  11. refack
    closed this as completedon Jun 26, 2017
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

    child_processIssues and PRs related to the child_process subsystem.feature requestIssues requesting new Node.js features.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.