Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
doc: reword warnings about sockets passed to subprocesses
Make the docs more concise. Make warnings direct ("do not use" and
"should") rather than "is not recommended" or "is recommended".

Backport-PR-URL: #34377
PR-URL: #34273
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Jul 16, 2020
1 parent ef31f17 commit 1dd2653
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions doc/api/child_process.md
Expand Up @@ -1380,14 +1380,12 @@ process.on('message', (m, socket) => {
});
```

Once a socket has been passed to a child, the parent is no longer capable of
tracking when the socket is destroyed. To indicate this, the `.connections`
property becomes `null`. It is recommended not to use `.maxConnections` when
this occurs.

It is also recommended that any `'message'` handlers in the child process
verify that `socket` exists, as the connection may have been closed during the
time it takes to send the connection to the child.
Do not use `.maxConnections` on a socket that has been passed to a subprocess.
The parent cannot track when the socket is destroyed.

Any `'message'` handlers in the subprocess should verify that `socket` exists,
as the connection may have been closed during the time it takes to send the
connection to the child.

### `subprocess.signalCode`

Expand Down

0 comments on commit 1dd2653

Please sign in to comment.