Skip to content

Commit

Permalink
doc: note synchronous part of child_process.spawn
Browse files Browse the repository at this point in the history
If an application has a large RSS (GB), jorangreef
observed that child_process.spawn will block the
event loop for ms-s.

This is surprising behavior and merits documentation.

Refs: #14917

PR-URL: #21234
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
davisjam authored and targos committed Jun 22, 2018
1 parent e038b2f commit 8a997a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ child registers an event handler for the [`'disconnect'`][] event
or the [`'message'`][] event. This allows the child to exit
normally without the process being held open by the open IPC channel.*

On UNIX-like operating systems, the [`child_process.spawn()`][] method
performs memory operations synchronously before decoupling the event loop
from the child. Applications with a large memory footprint may find frequent
[`child_process.spawn()`][] calls to be a bottleneck. For more information,
see [V8 issue 7381](https://bugs.chromium.org/p/v8/issues/detail?id=7381).

See also: [`child_process.exec()`][] and [`child_process.fork()`][].

## Synchronous Process Creation
Expand Down

0 comments on commit 8a997a5

Please sign in to comment.