-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Description
- Version: v4.4.4
- Platform: Linux XXXXXXXXXXX 3.13.0-62-generic url: improve parsing speed #102~precise1-Ubuntu SMP Wed Aug 12 14:09:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
The PR #4389 introduced servername
in the computation of the agent name.
If the caller of https.request()
does not supply servername
, _http_agent may introduce it in its method createSocket()
if the header host
is supplied. See here.
That introduced an inconsistency issue in the method addRequest()
, because getName()
is called before createSocket()
is called, which means on first call, it will not contain servername
, while it will on subsequent calls, in particular when handling destruction.
- Call to
getName()
:Line 121 in 572e28e
var name = this.getName(options); - Call to
createSocket()
in the same method:Line 144 in 572e28e
this.createSocket(req, options, function(err, newSocket) {
That created an issue for us. We are a high traffic site, and node was leaving a lot of sockets in TIME_WAIT state behind.
Expected
agent name computation and management in sockets
and freeSockets
should be consistent.
App-level workaround:
Always supply servername
in the options of https.request()
(Apologies, I haven't come up with a minimal test to highlight the problem, I figure it was more important to report the problem first, and I'll try to come up with a test after that.)