-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: check for handle before running asyncReset() #14419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the http module well enough to comment on this. I trust @refack's opinion.
😳 Just so you stop trusting me, I wanted to add this back in #13839 (comment) but forgot to open a new PR. |
const agent = new http.Agent({ | ||
keepAlive: true, | ||
}); | ||
const socket = new net.Socket(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trevnorris Re your comment #13045 (comment)
Could you add a test case for a Socket
with a fake _handle
?
@refack Added test. |
If an uninitialized or user supplied Socket is in the freeSockets list of the Agent it would automatically attempt to run ._handle.asyncReset(), but would throw from those not existing. Guard against that by first checking that they exist. PR-URL: nodejs#14419 Fixes: nodejs#13539 Refs: nodejs#13352 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
@refack Thanks for landing this. |
If an uninitialized or user supplied Socket is in the freeSockets list of the Agent it would automatically attempt to run ._handle.asyncReset(), but would throw from those not existing. Guard against that by first checking that they exist. PR-URL: #14419 Fixes: #13539 Refs: #13352 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http
If an uninitialized or user supplied Socket is in the freeSockets list of
the Agent it would automatically attempt to run ._handle.asyncReset(),
but would throw from those not existing. Guard against that by first
checking that they exist.
Fixes: #13539
Refs: #13352
CI: https://ci.nodejs.org/job/node-test-commit/11301/
refack: added ref to 13352