Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Conversation

ronag
Copy link
Member

@ronag ronag commented Sep 18, 2020

requestTimeout should be 0 by default for https just like http. The current default may cause breaking regressions in user code.

Fixes: #35261

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@ronag ronag requested a review from mcollina September 18, 2020 23:38
@ronag ronag requested a review from a team as a code owner September 18, 2020 23:38
@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. https Issues or PRs related to the https subsystem. labels Sep 18, 2020
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/http
  • @nodejs/net

@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2020
@ronag
Copy link
Member Author

ronag commented Sep 18, 2020

Fast track?

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 18, 2020
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a 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

@mcollina
Copy link
Member

@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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const errOrEnd = common.mustCall(function(err) {
const errOrEnd = common.mustCall(function() {

});
let response = '';

client.on('data', common.mustCall((chunk) => {
Copy link
Member

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?

Comment on lines 59 to 61
setTimeout(() => {
client.write('12345678901234567890\r\n\r\n');
}, common.platformTimeout(2000)).unref();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

@ronag
Copy link
Member Author

ronag commented Sep 19, 2020

@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.

@mcollina Please see @lpinca's comments.

@lpinca
Copy link
Member

lpinca commented Sep 20, 2020

Though we might want to fix those I think that's out of scope of this PR.

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.

@ronag
Copy link
Member Author

ronag commented Sep 20, 2020

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)?

@mcollina
Copy link
Member

Please do. I'll add a new test and fix the previous one after this land. We need to ship this asap.

@ronag ronag requested a review from lpinca September 20, 2020 09:37
@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 20, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 20, 2020
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Member

Is it ok now @lpinca?

@mcollina
Copy link
Member

@nodejs/tsc this needs to be fast-tracked.

@ronag ronag added v14.x request-ci Add this label to start a Jenkins CI on a PR. labels Sep 20, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 20, 2020
@nodejs-github-bot
Copy link
Collaborator

@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 20, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 20, 2020
@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Sep 21, 2020

Landed in 3e06e646520533636e447d854c751668ad33fb37

@Trott Trott closed this Sep 21, 2020
Trott pushed a commit that referenced this pull request Sep 21, 2020
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]>
@Trott
Copy link
Member

Trott commented Sep 21, 2020

Force-pushed 5461794

ruyadorno pushed a commit that referenced this pull request Sep 21, 2020
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]>
@ruyadorno ruyadorno mentioned this pull request Sep 21, 2020
4 tasks
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. https Issues or PRs related to the https subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Websocket connections incorrectly timing out after 2 minutes in node 14.11? Possible regression
7 participants