Skip to content

message not received in child process when forked with --eval #11948

Description

@kevinsawicki
  • Version: 7.7.3
  • Platform: Darwin 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
  • Subsystem: child_process

Messages sent to a process forked using --eval are not received by the child process.

var ChildProcess = require('child_process')

var source = "process.on('message', function (msg) { process.send(msg) })"

var forked = ChildProcess.fork('--eval', [source])

forked.on('message', function (msg) {
  console.log('message received:', msg)
})

forked.send('message')

Output with Node 7.0.0:

message received: message

No output will be logged for any Node version past 7.0.0, including latest 7.7.3.

Calling forked.send after a delay of ~50ms does cause the message to be received in the forked process on 7.7.3.

Refs electron/electron#8944

Activity

  1. added
    child_processIssues and PRs related to the child_process subsystem.
    on Mar 20, 2017
  2. bnoordhuis commented on Mar 21, 2017

    @bnoordhuis
    Member

    It's caused or exposed by c5b07d4. I'll take a look.

  3. bnoordhuis commented on Mar 21, 2017

    @bnoordhuis
    Member
  4. ChALkeR commented on Mar 30, 2017

    @ChALkeR
    Member

    #11958 landed, the provided testcase works on v7.8.0.

    @kevinsawicki, @bnoordhuis, is there anything left to do here?

  5. ChALkeR commented on Mar 30, 2017

    @ChALkeR
    Member

    The provided testcase doesn't work on v6.10.1 LTS.

  6. bnoordhuis commented on Mar 30, 2017

    @bnoordhuis
    Member

    It will once #11958 lands in v6.x. I'll close out the issue.

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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions