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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Trott authored and addaleax committed Sep 22, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent a210710 commit c1b5c89
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
@@ -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`

0 comments on commit c1b5c89

Please sign in to comment.