Skip to content

Commit c1b5c89

Browse files
Trottaddaleax
authored andcommitted
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 <[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]>
1 parent a210710 commit c1b5c89

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

doc/api/child_process.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,14 +1356,12 @@ process.on('message', (m, socket) => {
13561356
});
13571357
```
13581358

1359-
Once a socket has been passed to a child, the parent is no longer capable of
1360-
tracking when the socket is destroyed. To indicate this, the `.connections`
1361-
property becomes `null`. It is recommended not to use `.maxConnections` when
1362-
this occurs.
1363-
1364-
It is also recommended that any `'message'` handlers in the child process
1365-
verify that `socket` exists, as the connection may have been closed during the
1366-
time it takes to send the connection to the child.
1359+
Do not use `.maxConnections` on a socket that has been passed to a subprocess.
1360+
The parent cannot track when the socket is destroyed.
1361+
1362+
Any `'message'` handlers in the subprocess should verify that `socket` exists,
1363+
as the connection may have been closed during the time it takes to send the
1364+
connection to the child.
13671365

13681366
### `subprocess.signalCode`
13691367

0 commit comments

Comments
 (0)