-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: https requestTimeout 0 #35264
http: https requestTimeout 0 #35264
Conversation
Review requested:
|
Fast track? |
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.
lgtm
my bad! +1 to fast-track
@nodejs/build this should hit v14 as soon as possible. |
client.write('12345678901234567890\r\n\r\n'); | ||
}, common.platformTimeout(2000)).unref(); | ||
|
||
const errOrEnd = common.mustCall(function(err) { |
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.
const errOrEnd = common.mustCall(function(err) { | |
const errOrEnd = common.mustCall(function() { |
}); | ||
let response = ''; | ||
|
||
client.on('data', common.mustCall((chunk) => { |
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.
How can you be sure that this is called only once?
setTimeout(() => { | ||
client.write('12345678901234567890\r\n\r\n'); | ||
}, common.platformTimeout(2000)).unref(); |
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.
setTimeout(() => { | |
client.write('12345678901234567890\r\n\r\n'); | |
}, common.platformTimeout(2000)).unref(); |
This does not seem to be very useful. The other peer already destroyed the socket when this write is attempted so this will result in a guaranteed error, no?
Also shouldn't all the writes be done after the 'connect'
event?
}); | ||
|
||
client.on('end', errOrEnd); | ||
client.on('error', errOrEnd); |
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.
client.on('error', errOrEnd); |
errOrEnd
is returned by common.mustCall()
so it can only be called once but is used a listener for two different events. This does not seem correct.
Under what circumstances is the 'error'
event emitted here? I can only think of connection errors and a write after end error. I think the latter never occurs as the timer that would cause this is unrefed (the process exists before the write on line 60 occurs).
@lpina: The added test is just a copy paste from an existing test but with http replaced with https. This landed in 753f3b247a. Though we might want to fix those I think that's out of scope of this PR, i.e. I don't think we should stop this PR from fast tracking due to this. |
I disagree. It's a copy paste of an existing test, yes but it's a new test so I see no reason to open a new PR to fix it. We can improve the test without a new PR and still fast track this. |
I see. I don't have the answers to your comments. Sorting them out will probably take a while unless the original author has time. Should I remove most of the test and just add an assertion for the default value instead (which is what this PR is fixing)? |
Please do. I'll add a new test and fix the previous one after this land. We need to ship this asap. |
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.
lgtm
Is it ok now @lpinca? |
@nodejs/tsc this needs to be fast-tracked. |
Co-authored-by: Luigi Pinca <[email protected]>
|
Fixes: #35261 PR-URL: #35264 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Force-pushed 5461794 |
Fixes: #35261 PR-URL: #35264 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Fixes: nodejs#35261 PR-URL: nodejs#35264 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Rich Trott <[email protected]>
requestTimeout
should be0
by default forhttps
just likehttp
. The current default may cause breaking regressions in user code.Fixes: #35261
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes