Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kevinsawicki opened this issue Mar 20, 2017 · 5 comments · Fixed by electron/electron#9132
Closed

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

kevinsawicki opened this issue Mar 20, 2017 · 5 comments · Fixed by electron/electron#9132
Labels
child_process Issues and PRs related to the child_process subsystem.

Comments

@kevinsawicki
Copy link

  • 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

@bnoordhuis
Copy link
Member

bnoordhuis commented Mar 21, 2017

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

@bnoordhuis
Copy link
Member

#11958

@ChALkeR
Copy link
Member

ChALkeR commented Mar 30, 2017

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

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

@ChALkeR
Copy link
Member

ChALkeR commented Mar 30, 2017

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

@bnoordhuis
Copy link
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
Labels
child_process Issues and PRs related to the child_process subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants