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

The timeout mentioned in the error message is different from the actually applied request timeout #3659

Closed
mykola-mokhnach opened this issue Feb 24, 2021 · 4 comments

Comments

@mykola-mokhnach
Copy link

mykola-mokhnach commented Feb 24, 2021

Describe the bug

A clear and concise description of what the bug is. If your problem is not a bug, please file under Support or Usage Question

The timeout value mentioned in the timeout error message is different from the actually applied request timeout. See the code example below.

To Reproduce

Code snippet to reproduce, ideally that will work by pasting into something like https://npm.runkit.com/axios, a hosted solution, or a repository that illustrates the issue. If your problem is not reproducible, please file under Support or Usage Question

    const agentOpts = {
      keepAlive: true,
      timeout: 60000,
    };
    const httpAgent = new http.Agent(agentOpts);
    const httpsAgent = new https.Agent(agentOpts);
    const reqOpts = {
      url: 'http://some_site_where_read_timeout_happens.com',
      method: 'GET',
      timeout: 240000,
      httpAgent,
      httpsAgent,
    };
    await axios(reqOpts);

Expected behavior

This code throws an exception, which looks like

2021-02-23 20:30:49.687 INFO  [WD Proxy] Error: timeout of 240000ms exceeded 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at createError (/usr/local/lib/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at RedirectableRequest.handleRequestTimeout (/usr/local/lib/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at Object.onceWrapper (events.js:428:26) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at RedirectableRequest.emit (events.js:321:20) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at ClientRequest.eventHandlers.<computed> (/usr/local/lib/node_modules/appium/node_modules/follow-redirects/index.js:13:24) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at ClientRequest.emit (events.js:321:20) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at Socket.emitRequestTimeout (_http_client.js:721:9) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at Object.onceWrapper (events.js:427:28) 
2021-02-23 20:30:49.688 INFO  [WD Proxy]     at Socket.emit (events.js:321:20) 
2021-02-23 20:30:49.689 INFO  [WD Proxy]     at Socket._onTimeout (net.js:478:8) 
2021-02-23 20:30:49.689 INFO  [WD Proxy]     at listOnTimeout (internal/timers.js:549:17) 
2021-02-23 20:30:49.689 INFO  [WD Proxy]     at processTimers (internal/timers.js:492:7) 

although the actual time elapsed after the request is sent is 60 seconds, which is equal to the httpAgent option value. I expect axios to rather put the correct timeout value into the exception message or to actually wait 240 seconds, so the timeout set in request options overrides the one that is set for a http(s) agent instance.

Environment

  • Axios Version [e.g. 0.18.0]: 0.21.1
  • Adapter [e.g. XHR/HTTP]: http
  • Browser [e.g. Chrome, Safari]: Node.js
  • Browser Version [e.g. 22] -
  • Node.js Version [e.g. 13.0.1]: v12.20.0
  • OS: [e.g. iOS 12.1.0, OSX 10.13.4]: OSX 10.15.7
  • Additional Library Versions [e.g. React 16.7, React Native 0.58.0]

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.

@djs113
Copy link
Contributor

djs113 commented Aug 16, 2021

When I tried I got the correct timeout, I think this issue should be closed.

@ifeltsweet
Copy link

ifeltsweet commented Oct 8, 2021

We have the exact same issue as described here in v0.21.1.

@ifeltsweet
Copy link

ifeltsweet commented Oct 8, 2021

This seems to be fixed in v0.21.4.

@jasonsaayman
Copy link
Member

Hi 👋

Please could you retry with the latest version and open a new issue should this error still be relevant?

Thanks

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

No branches or pull requests

4 participants