Skip to content

Commit 8a997a5

Browse files
davisjamtargos
authored andcommitted
doc: note synchronous part of child_process.spawn
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>
1 parent e038b2f commit 8a997a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/child_process.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,12 @@ child registers an event handler for the [`'disconnect'`][] event
652652
or the [`'message'`][] event. This allows the child to exit
653653
normally without the process being held open by the open IPC channel.*
654654

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

657663
## Synchronous Process Creation

0 commit comments

Comments
 (0)