Skip to content

Commit 1dd2653

Browse files
TrottMylesBorins
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 ef31f17 commit 1dd2653

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
@@ -1380,14 +1380,12 @@ process.on('message', (m, socket) => {
13801380
});
13811381
```
13821382

1383-
Once a socket has been passed to a child, the parent is no longer capable of
1384-
tracking when the socket is destroyed. To indicate this, the `.connections`
1385-
property becomes `null`. It is recommended not to use `.maxConnections` when
1386-
this occurs.
1387-
1388-
It is also recommended that any `'message'` handlers in the child process
1389-
verify that `socket` exists, as the connection may have been closed during the
1390-
time it takes to send the connection to the child.
1383+
Do not use `.maxConnections` on a socket that has been passed to a subprocess.
1384+
The parent cannot track when the socket is destroyed.
1385+
1386+
Any `'message'` handlers in the subprocess should verify that `socket` exists,
1387+
as the connection may have been closed during the time it takes to send the
1388+
connection to the child.
13911389

13921390
### `subprocess.signalCode`
13931391

0 commit comments

Comments
 (0)