Skip to content

Commit

Permalink
doc: reword warnings about sockets passed to subprocesses
Browse files Browse the repository at this point in the history
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 addaleax committed Sep 22, 2020
1 parent 614f1e5 commit 5dd37c4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions doc/api/child_process.md
Expand Up @@ -1356,14 +1356,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 5dd37c4

Please sign in to comment.