Title: request with agent, timeout not work · Issue #21185 · nodejs/node · GitHub
Open Graph Title: request with agent, timeout not work · Issue #21185 · nodejs/node
X Title: request with agent, timeout not work · Issue #21185 · nodejs/node
Description: Version: 10.3 Platform: all Subsystem: http When request with agent, set the request timeout not work, timeout is still agent timeout. The code: 'use strict'; const http = require('http'); const port = 8000; const AGENT_TIMEOUT = 3000; c...
Open Graph Description: Version: 10.3 Platform: all Subsystem: http When request with agent, set the request timeout not work, timeout is still agent timeout. The code: 'use strict'; const http = require('http'); const po...
X Description: Version: 10.3 Platform: all Subsystem: http When request with agent, set the request timeout not work, timeout is still agent timeout. The code: 'use strict'; const http = require('http...
Opengraph URL: https://github.com/nodejs/node/issues/21185
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"request with agent, timeout not work","articleBody":"\u003c!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n--\u003e\r\n\r\n* **Version**: 10.3\r\n* **Platform**: all\r\n* **Subsystem**: http\r\n\r\n\u003c!-- Enter your issue details below this comment. --\u003e\r\n\r\nWhen request with agent, set the request timeout not work, timeout is still\r\nagent timeout.\r\n\r\nThe code:\r\n``` javascript\r\n'use strict';\r\n\r\nconst http = require('http');\r\nconst port = 8000;\r\nconst AGENT_TIMEOUT = 3000;\r\nconst HTTP_TIMEOUT = 5000;\r\n\r\nconst server = http\r\n .createServer((req, res) =\u003e {\r\n console.log('never response');\r\n })\r\n .listen({ port }, () =\u003e doRequest());\r\n\r\nfunction doRequest() {\r\n const agent = new http.Agent({ timeout: AGENT_TIMEOUT });\r\n const request = http.request({\r\n host: 'localhost',\r\n port,\r\n agent,\r\n timeout: HTTP_TIMEOUT, // The HTTP_TIMEOUT will not work.\r\n }, res =\u003e {});\r\n\r\n request.end();\r\n\r\n const start = Date.now();\r\n request.on('timeout', () =\u003e {\r\n console.log('timeout:' + (Date.now() - start)); // It print 3000, not 5000\r\n request.abort();\r\n server.close();\r\n });\r\n\r\n request.on('error', () =\u003e {});\r\n}\r\n```\r\nI expect request timeout will overwrite the agent time out.\r\n\r\nIf it's a bug, I can make a PR to fix it.","author":{"url":"https://github.com/killagu","@type":"Person","name":"killagu"},"datePublished":"2018-06-07T08:04:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/21185/node/issues/21185"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b8e27549-e985-2d73-64ce-7eab801cb983 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBC4:C3948:26D92D1:357ADD9:6A4EF321 |
| html-safe-nonce | f53d21cb0827d396b73d038f7a8c7e3b612c41c44f97f32a18c8685bdb2a383a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkM0OkMzOTQ4OjI2RDkyRDE6MzU3QUREOTo2QTRFRjMyMSIsInZpc2l0b3JfaWQiOiIyNTI5NDI2MzMzOTc4NTIyNDAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1e77dc54e8e328dbacfeb7b0776d63a75e198ba6a008b650e72a1b00be64797a |
| hovercard-subject-tag | issue:330160455 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/21185/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c237f925a16ac435e5974bce0e411b0638740b4e683cacb53cebe8642b5133c7/nodejs/node/issues/21185 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c237f925a16ac435e5974bce0e411b0638740b4e683cacb53cebe8642b5133c7/nodejs/node/issues/21185 |
| og:image:alt | Version: 10.3 Platform: all Subsystem: http When request with agent, set the request timeout not work, timeout is still agent timeout. The code: 'use strict'; const http = require('http'); const po... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | killagu |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width