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".

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 committed Jul 12, 2020
1 parent a98426a commit ac6ecd6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1380,13 +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. It is recommended not to use
`.maxConnections` when this occurs.
Do not use `.maxConnections` on a socket that has been passed to a subprocess.
The parent cannot track when the socket is destroyed.

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.
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 ac6ecd6

Please sign in to comment.