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: make timeout event work with agent timeout #25488

Closed
wants to merge 1 commit into from

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Jan 14, 2019

The 'timeout' event is currently not emitted on the ClientRequest
instance when the socket timeout expires if only the timeout option
of the agent is set. This happens because, under these circumstances,
listenSocketTimeout() is not called.

This commit fixes the issue by calling it also when only the agent
timeout option is set.

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

@nodejs-github-bot
Copy link
Collaborator

@lpinca sadly an error occured when I tried to trigger a build :(

@nodejs-github-bot nodejs-github-bot added the http Issues or PRs related to the http subsystem. label Jan 14, 2019
@lpinca
Copy link
Member Author

lpinca commented Jan 14, 2019

The `'timeout'` event is currently not emitted on the `ClientRequest`
instance when the socket timeout expires if only the `timeout` option
of the agent is set. This happens because, under these circumstances,
`listenSocketTimeout()` is not called.

This commit fixes the issue by calling it also when only the agent
`timeout` option is set.
@lpinca
Copy link
Member Author

lpinca commented Jan 21, 2019

cc: @nodejs/http
New CI: https://ci.nodejs.org/job/node-test-pull-request/20222/ (:heavy_check_mark:)

@addaleax
Copy link
Member

@lpinca Do you want to merge this?

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 28, 2019
@lpinca
Copy link
Member Author

lpinca commented Jan 29, 2019

@addaleax let's wait a little more for another approval, it's not a critical issue. We can merge this in a couple of days if nothing changed.

Thank you.

@lpinca
Copy link
Member Author

lpinca commented Jan 31, 2019

Landed in 4b6e4c1.

@lpinca lpinca closed this Jan 31, 2019
@lpinca lpinca deleted the fix/timeout-event branch January 31, 2019 10:52
lpinca added a commit that referenced this pull request Jan 31, 2019
The `'timeout'` event is currently not emitted on the `ClientRequest`
instance when the socket timeout expires if only the `timeout` option
of the agent is set. This happens because, under these circumstances,
`listenSocketTimeout()` is not called.

This commit fixes the issue by calling it also when only the agent
`timeout` option is set.

PR-URL: #25488
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos
Copy link
Member

targos commented Jan 31, 2019

The test added in this PR fails on my computer:

AssertionError [ERR_ASSERTION]: Expected "actual" to be reference-equal to "expected":
+ actual - expected ... Lines skipped

  Comparison {
+   code: 'EHOSTUNREACH',
+   message: 'connect EHOSTUNREACH 192.0.2.1:80',
-   code: 'ECONNRESET',
-   message: 'socket hang up',
    type: [Function: Error] {
...
    }
  }
    at new AssertionError (internal/assert.js:396:11)

@lpinca
Copy link
Member Author

lpinca commented Jan 31, 2019

Ok, I will change it to prevent it from using a non routable IP address so it will not be flaky. I'll get to it as soon as I can.

lpinca added a commit to lpinca/node that referenced this pull request Jan 31, 2019
Fix flakyness caused by usage of a non-routable IP address.

Refs: nodejs#25488 (comment)
addaleax pushed a commit that referenced this pull request Feb 1, 2019
The `'timeout'` event is currently not emitted on the `ClientRequest`
instance when the socket timeout expires if only the `timeout` option
of the agent is set. This happens because, under these circumstances,
`listenSocketTimeout()` is not called.

This commit fixes the issue by calling it also when only the agent
`timeout` option is set.

PR-URL: #25488
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Trott pushed a commit to Trott/io.js that referenced this pull request Feb 2, 2019
Fix flakyness caused by usage of a non-routable IP address.

Refs: nodejs#25488 (comment)

PR-URL: nodejs#25854
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
addaleax pushed a commit that referenced this pull request Feb 3, 2019
Fix flakyness caused by usage of a non-routable IP address.

Refs: #25488 (comment)

PR-URL: #25854
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
@targos targos mentioned this pull request Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants