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

Improve timeouts accuracy and node v6.8.0+ compatibility #2431

Merged
merged 3 commits into from Oct 20, 2016

Conversation

mscdex
Copy link
Contributor

@mscdex mscdex commented Oct 19, 2016

This PR fixes a timeout-related compatibility issue with node v6.8.0+ and makes the connection and request/response timeout more accurate by starting them at more appropriate times.

node v6.8.0 supports a `timeout` option now, so we should
explicitly delete it in case the value is < 0 (in which case
node will throw an error). Handling timeouts manually for now
is better for consistency with older node versions.
Prior to this commit, the connection timeout could include some
amount of time that passes before the socket actually starts its
connection attempt.

Additionally, this commit only starts the request timeout once a
connection is made. This helps to prevent an issue where one kind of
timeout is seen instead of another (ETIMEDOUT vs ESOCKETTIMEOUT)
while connecting in some situations (depending on OS and possibly
node version).
@mscdex
Copy link
Contributor Author

mscdex commented Oct 19, 2016

FWIW the flaky CI failure here is fixed by the relevant commit in #2415.

@simov simov merged commit 995cc31 into request:master Oct 20, 2016
@mscdex mscdex deleted the timeouts-accuracy branch November 15, 2016 17:57
pulkitsinghal added a commit to ShoppinPal/vend-nodejs-sdk that referenced this pull request Sep 15, 2017
## Motivation
- Some upstream projects that use `vend-nodejs-sdk` were facing strange
issues where long-running use (after 47 minutes or so) led so a situation
where nodejs would just hang after a POST request.
- There weren't any clear CPU or Memory consumption red flags.
- It seemed more like a bad promise chain or failing to invoke a callback
that often leads nodejs into a forever running state and there's nothing
really going on.

## Solution
Look at the [CHANGELOG](https://github.com/request/request/blob/master/CHANGELOG.md)
for `request` and see if any plausible reasons for trying a module update.

1. request/request#2431
2. request/request#2414
3. request/request#2447
4. request/request#2448

This wasn't an exact science but their descriptions seemed to merit
the dependency upgrade as "at least worth a try"

## Consequences
Dropped support for Node 0.10
request/request#2381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants