diff options
author | Robert Nagy <ronagy@icloud.com> | 2020-02-29 00:27:39 +0300 |
---|---|---|
committer | Robert Nagy <ronagy@icloud.com> | 2020-03-07 22:51:12 +0300 |
commit | 8700d89306cc4c1fd1a540d4b8f27a59f7b4957e (patch) | |
tree | 9b161fd04384e0284112777443ff1e075f98a537 /doc/api/http.md | |
parent | 1b3dbc9635d45c83e355d312b6114d58664b1e7a (diff) |
http: fix socket re-use races
Whether and when a socket is destroyed or not after a timeout is up to
the user. This leaves an edge case where a socket that has emitted
'timeout' might be re-used from the free pool. Even if destroy is called
on the socket, it won't be removed from the freelist until 'close' which
can happen several ticks later.
Sockets are removed from the free list on the 'close' event.
However, there is a delay between calling destroy() and 'close'
being emitted. This means that it possible for a socket that has
been destroyed to be re-used from the free list, causing unexpected
failures.
PR-URL: https://github.com/nodejs/node/pull/32000
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc/api/http.md')
-rw-r--r-- | doc/api/http.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md index f6aa93ecedc..3b45a36546d 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -239,6 +239,9 @@ added: v0.11.4 An object which contains arrays of sockets currently awaiting use by the agent when `keepAlive` is enabled. Do not modify. +Sockets in the `freeSockets` list will be automatically destroyed and +removed from the array on `'timeout'`. + ### `agent.getName(options)` <!-- YAML added: v0.11.4 |