-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
tls: add host and port info to ECONNRESET errors #7476
Conversation
Is there potential to reuse |
const net = require('net'); | ||
|
||
net.createServer(c => { | ||
setTimeout(() => c.end(), 300); |
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.
Is the timeout necessary?
27b73ad
to
cbd133d
Compare
@santigimeno thanks for all the feedback in the test case :) @cjihrig good point! I will try |
@cjihrig I can't find a way to call
I see this function is being used in two places, the first argument being the error returned from |
Ah, sorry, it expects an error code, and we're creating an error object here. Carry on :-) |
Don't have any particular issue with this but I'd like to get some more opinions. @nodejs/ctc |
LGTM |
https.get(`https://localhost:${port}`) | ||
.on('error', common.mustCall(e => { | ||
assert.equal(e.host, 'localhost'); | ||
assert.equal(e.port, port); |
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.
Can you use assert.strictEqual here?
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.
good catch, I am not sure why it ends up being an string at _tls_wrap.connect
It would be nice to have test coverage for |
cbd133d
to
539ebd7
Compare
@bnoordhuis thank you very much for the feedback. I added tests for |
539ebd7
to
7681074
Compare
I did some changes to the PR to include the address when using |
7681074
to
7ce5824
Compare
lib/_tls_wrap.js
Outdated
}; | ||
} | ||
} | ||
|
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.
This adds a closure and makes the closure for onHangup() bigger (i.e., more memory, more gc'ing.) I would like to avoid that.
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.
@bnoordhuis ok, I am going to revert to what I had before, but I won't be able to handle the options.socket
case properly, because it seems that socket.remoteAddress
is deleted before the end
event.
7ce5824
to
bd4dc97
Compare
@bnoordhuis updated with your suggestion. thanks again |
assert.strictEqual(e.port, undefined); | ||
assert.strictEqual(e.host, undefined); | ||
server.close(); | ||
}, 'the request must emit error')); |
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.
common.mustCall
doesn't take a string as its second argument.
bd4dc97
to
6652492
Compare
Looks like this one slipped through the cracks |
Is there anything I can help with to get this one and #7498 merged? Thanks |
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.
looks like there are enough approvals for this to land if tests are happy.
It's semver-minor. Can we just land it? |
Yep. It's on my list to review on Monday but if you'd like to go ahead, go for it.. |
Last CI was half a year ago, I will land this today if CI passes: https://ci.nodejs.org/job/node-test-pull-request/8655/ Edit: Retrying osx only: https://ci.nodejs.org/job/node-test-commit-osx/10491/ |
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
CI is green, landed in 3ee3732! Thank you for your contribution! 🎉 |
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: #7476 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Yazhong Liu <[email protected]>
Release team decided not to land on v6.x, if you disagree let us know. |
@gibfahn What was the motivation? It's pretty useful. |
IIRC the motivation was that this changes an error message, which could break people. If that's not true we can reconsider. |
It is not true, it doesn't change the error message. It just add new properties to the error object:
This is currently being done in other places with the same property names (I can't remember now where) and I think is very useful to diagnose issues with tcp connections. |
cc/ @nodejs/lts let's reconsider. |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
TLS
Description of change
Add more information (host, port, path) to the "ECONNRESET" errors generated when the
socket hang ups before establishing the secure connection.
These kind of errors are really hard to troubleshoot without this info.