Skip to content

Flexible stdios for IPC #20000

Open
Open
@gireeshpunathil

Description

@gireeshpunathil
  • Version: master
  • Platform: all
  • Subsystem: child_process

A noted problem pattern is broken data flow when i) spawning OS commands that predate Node.js and that do not expect their stdios to be non-blocking. ii) Composite IPC that involves more than one Node process in the process chain.

The underlying issue is the mixed mode I/O in a number of variations based on number of parent-child combo that is possible.

While many of these can be mitigated by studying the I/O characteristics of parent and child and crafting a suitable IPC that works, inability to (programatically) control the blocking behavior (flow mode) of the stdio channel causes usability issues.

Proposals:

Node parent -> non-Node child
Node parent - Node child

  • exec family functions to receive option to control the blocking behavior of child stdios (new option)
  • adjust the child stdios accordingly, while retaining parent side of pipes non-blocking
  • convert stdout and stderr to nonblocking prior to exit to help drain the buffered chunks (revisit process: flush stdout/stderr upon process.exit() #6773)

Node parent - non-Node child -> Node grand child
Node parent - non-Node child -> non-Node grand child

references:
truncated stdout on porcess exit: #19218 #784 #6456 #6379
pre-fabricated duplex streams for IPC: #16553 #15714 #13542
inconsistent IPC with process chain: #9413
unexpected flow mode for stdio: #14752 #18446 #19838

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.stdioIssues and PRs related to stdio.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions