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: emit timeout duration overflow warning sync #18906

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

Emit the TimeoutOverflowWarning synchronously, even when
still connecting, to get a better stack trace.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

http

@nodejs-github-bot nodejs-github-bot added the http Issues or PRs related to the http subsystem. label Feb 21, 2018
@addaleax addaleax changed the title http: emit timeout duration overlow warning sync http: emit timeout duration overflow warning sync Feb 21, 2018
@addaleax
Copy link
Member Author

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 22, 2018
@benjamingr
Copy link
Member

Emit the `TimeoutOverflowWarning` synchronously, even when
still connecting, to get a better stack trace.
@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 2, 2018
@addaleax
Copy link
Member Author

addaleax commented Mar 2, 2018

@nodejs/http The test I’m adding here is failing in some CI machines with:

    events.js:116
          throw er; // Unhandled 'error' event
          ^
    
    Error: read ECONNRESET
        at TCP.onread (net.js:625:25)

Could I ask you to take a look at the test? I’m pretty certain it’s not related to the code change here, but I’d be curious to know whether there’s anything obviously wrong with it…

http.request(`http://localhost:${server.address().port}`)
.setTimeout(2 ** 40)
.end(() => {
server.close();
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this would be considered an issue with the test... there's a race condition between the server being closed and the request being processed. Most of these http tests would put the server.close(); in an event listener for end rather than a callback. Not sure if this is expected behaviour or a bug though... I can see a case for both.

Copy link
Member

Choose a reason for hiding this comment

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

@addaleax
Copy link
Member Author

addaleax commented Mar 2, 2018

@apapirovski Okay, I think I got it right. I am surprised though, I wouldn’t think it’s possible for the req.end() callback to fire before the connection is actually established?

CI: https://ci.nodejs.org/job/node-test-commit/16605/

@apapirovski
Copy link
Member

@addaleax Yeah, I honestly don't know... As far as I can tell, no one that knows the http module well is around and contributing anymore, and it's so convoluted and full of edge case handling that it's really, really hard to get a proper understanding of everything that's going on. I've considered doing some refactoring in the past but not sure where to start even...

@apapirovski
Copy link
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/13483/ (Windows completely failed last time around)

@addaleax
Copy link
Member Author

addaleax commented Mar 4, 2018

Landed in 648d668

@addaleax addaleax closed this Mar 4, 2018
@addaleax addaleax deleted the http-timeout-warning branch March 4, 2018 21:55
addaleax added a commit that referenced this pull request Mar 4, 2018
Emit the `TimeoutOverflowWarning` synchronously, even when
still connecting, to get a better stack trace.

With thanks to Anatoli Papirovski for providing helpful
tips when writing the test.

PR-URL: #18906
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Emit the `TimeoutOverflowWarning` synchronously, even when
still connecting, to get a better stack trace.

With thanks to Anatoli Papirovski for providing helpful
tips when writing the test.

PR-URL: nodejs#18906
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants