René's URL Explorer Experiment


Title: Socket timeouts are checked before pending incoming requests are assigned sockets, causing `ECONNRESET`s · Issue #43456 · nodejs/node · GitHub

Open Graph Title: Socket timeouts are checked before pending incoming requests are assigned sockets, causing `ECONNRESET`s · Issue #43456 · nodejs/node

X Title: Socket timeouts are checked before pending incoming requests are assigned sockets, causing `ECONNRESET`s · Issue #43456 · nodejs/node

Description: Version 14.19.1 and others Platform Linux qa01-api-1 5.13.0-1024-gcp #29~20.04.1-Ubuntu SMP Thu Apr 14 23:15:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Subsystem net What steps will reproduce the bug? Process 1: const crypto = require("c...

Open Graph Description: Version 14.19.1 and others Platform Linux qa01-api-1 5.13.0-1024-gcp #29~20.04.1-Ubuntu SMP Thu Apr 14 23:15:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Subsystem net What steps will reproduce the b...

X Description: Version 14.19.1 and others Platform Linux qa01-api-1 5.13.0-1024-gcp #29~20.04.1-Ubuntu SMP Thu Apr 14 23:15:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Subsystem net What steps will reproduce the b...

Opengraph URL: https://github.com/nodejs/node/issues/43456

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Socket timeouts are checked before pending incoming requests are assigned sockets, causing `ECONNRESET`s","articleBody":"### Version\n\n14.19.1 and others\n\n### Platform\n\nLinux qa01-api-1 5.13.0-1024-gcp #29~20.04.1-Ubuntu SMP Thu Apr 14 23:15:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux\n\n### Subsystem\n\nnet\n\n### What steps will reproduce the bug?\n\n##### Process 1:\r\n```js\r\nconst crypto = require(\"crypto\");\r\nconst http = require('http');\r\n\r\nconst a = Buffer.alloc(1e8);\r\nfunction doWork(ms) {\r\n\tconst start = Date.now();\r\n\twhile (Date.now() - start \u003c ms) {\r\n\t\tcrypto.randomFillSync(a);\r\n\t}\r\n}\r\n\r\nlet socketId = 0;\r\nconst server = http.createServer((req, res) => {\r\n\tif (req.socket.__socketId === undefined) {\r\n\t\treq.socket.__socketId = socketId++;\r\n\t\tconst st = req.socket.setTimeout;\r\n\t\treq.socket.setTimeout = (a, b) => {\r\n\t\t\tconsole.log(new Date(), \"Setting timeout on socket \", req.socket.__socketId);\r\n\t\t\treturn st.call(req.socket, a, b);\r\n\t\t};\r\n\t\treq.socket.once(\"close\", () => console.log(new Date(), `Closing ${req.socket.__socketId}`));\r\n\t}\r\n\r\n\tconst reqId = req.headers[\"x-request-id\"];\r\n\tconsole.log(new Date(), `[${reqId}] got request on socket ${req.socket.__socketId}`);\r\n\tdoWork(1500);\r\n\tconsole.log(new Date(), `[${reqId}] sending response`);\r\n\tres.end('hello world\\r\\n');\r\n});\r\n\r\nserver.keepAliveTimeout = 1000; // shortened from default 5000 to make test faster\r\n\r\nserver.listen(8080, '127.0.0.1');\r\n```\r\n\r\n##### Process 2:\r\n```js\r\nconst http = require('http');\r\n\r\nconst keepAliveAgent = new http.Agent({\r\n\tkeepAlive: true,\r\n\tmaxSockets: 2\r\n});\r\n\r\nlet socketId = 0;\r\n\r\nfor (let i = 0; i \u003c 3; i++) {\r\n\tconst req = http.request({\r\n\t\tagent: keepAliveAgent,\r\n\t\thost: '127.0.0.1',\r\n\t\tport: 8080,\r\n\t\tmethod: 'GET',\r\n\t\theaders: {\r\n\t\t\t\"X-Request-Id\": `${i}`\r\n\t\t}\r\n\t});\r\n\r\n\treq.end();\r\n\r\n\treq.once(\"socket\", socket => {\r\n\t\tif (socket.__id === undefined) socket.__id = socketId++;\r\n\t\tconsole.log(new Date(), `[${i}] assigned socket ${socket.__id}`);\r\n\t});\r\n\r\n\treq.on('response', function _onResponse(res) {\r\n\t\tres.on('data', function _onData(chunk) {});\r\n\r\n\t\tres.on('end', function _doneResponse() {\r\n\t\t\tconsole.log(new Date(), `[${i}] res.end`);\r\n\t\t});\r\n\t});\r\n\r\n\treq.on('error', function _onError(err) {\r\n\t\tconsole.log(new Date(), `[${i}] req.error`, err);\r\n\t});\r\n}\r\n```\n\n### How often does it reproduce? Is there a required condition?\n\n100%\n\n### What is the expected behavior?\n\nAll three requests should succeed.\n\n### What do you see instead?\n\nThe server logs will look like this:\r\n```\r\n2022-06-16T22:37:50.307Z [0] got request on socket 0\r\n2022-06-16T22:37:51.809Z [0] sending response\r\n2022-06-16T22:37:51.813Z Setting timeout on socket  0\r\n2022-06-16T22:37:51.814Z [1] got request on socket 1\r\n2022-06-16T22:37:53.317Z [1] sending response\r\n2022-06-16T22:37:53.318Z Setting timeout on socket  1\r\n2022-06-16T22:37:53.320Z Closing 0\r\n2022-06-16T22:37:53.323Z Closing 1\r\n```\r\n\r\nand client\r\n```\r\n2022-06-16T22:37:50.303Z [0] assigned socket 0\r\n2022-06-16T22:37:50.305Z [1] assigned socket 1\r\n2022-06-16T22:37:51.814Z [0] res.end\r\n2022-06-16T22:37:51.815Z [2] assigned socket 0\r\n2022-06-16T22:37:53.318Z [1] res.end\r\n2022-06-16T22:37:53.321Z [2] req.error Error: read ECONNRESET\r\n    at TCP.onStreamRead (internal/stream_base_commons.js:209:20) {\r\n  errno: -104,\r\n  code: 'ECONNRESET',\r\n  syscall: 'read'\r\n}\r\n```\r\n\r\nNotice: req[2] is assigned a socket at 51.815, just after req[1] is received by the server. Server socket[0] is closed at 53.320, just after the blocking work on req[2], even though there's a request that could be assigned to that socket. I think what's happening is that timers are checked *before* pending incoming messages are assigned sockets.\n\n### Additional information\n\n`ECONNRESET`s due to Keep-Alive races need to be handled by clients (see #20256, #38890 and several others), but I think this particular scenario can be fixed to avoid a subset of them.","author":{"url":"https://github.com/zbjornson","@type":"Person","name":"zbjornson"},"datePublished":"2022-06-16T22:46:37Z","url":"https://github.com/nodejs/node/issues/43456"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:cbe63ff5-98d6-db3e-33b8-9f1728d755ac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD892:26D535:627421:80835A:6AED2DB9
html-safe-nonceb9437a513af8f17f359c6279f6baf0d86135d2b0f039546418d52482804f9203
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODkyOjI2RDUzNTo2Mjc0MjE6ODA4MzVBOjZBRUQyREI5IiwidmlzaXRvcl9pZCI6IjU3MjUwMjcwNDc1NTM0NDUzMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf445fb5288395de445622789981623aea6e18e50737d12585d75eca901fae81c
hovercard-subject-tagissue:1274178433
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/43456/issue_layout
twitter:imagehttps://opengraph.githubassets.com/084ee098dd4802331b2d378f5a902ee0bf08c629cda6f1deb7b36a972d388d98/nodejs/node/issues/43456
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/084ee098dd4802331b2d378f5a902ee0bf08c629cda6f1deb7b36a972d388d98/nodejs/node/issues/43456
og:image:altVersion 14.19.1 and others Platform Linux qa01-api-1 5.13.0-1024-gcp #29~20.04.1-Ubuntu SMP Thu Apr 14 23:15:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Subsystem net What steps will reproduce the b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezbjornson
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/43456#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F43456
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F43456
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/43456
Reloadhttps://github.com/nodejs/node/issues/43456
Reloadhttps://github.com/nodejs/node/issues/43456
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43456
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43456
Socket timeouts are checked before pending incoming requests are assigned sockets, causing ECONNRESETshttps://github.com/nodejs/node/issues/43456#top
httpIssues and PRs related to the http subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com/zbjornson
zbjornsonhttps://github.com/zbjornson
on Jun 16, 2022https://github.com/nodejs/node/issues/43456#issue-1274178433
#29https://github.com/nodejs/node/pull/29
#20256https://github.com/nodejs/node/issues/20256
#38890https://github.com/nodejs/node/issues/38890
F3n67uhttps://github.com/F3n67u
httpIssues and PRs related to the http subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%22
on Jun 17, 2022https://github.com/nodejs/node/issues/43456#event-6825069229
https://github.com/theanarkh
theanarkhhttps://github.com/theanarkh
on Jun 17, 2022https://github.com/nodejs/node/issues/43456#issuecomment-1159048360
https://user-images.githubusercontent.com/21155906/174340285-3d75dfe8-94df-4154-8328-06d06f09f4b1.png
https://github.com/zbjornson
zbjornsonhttps://github.com/zbjornson
on Jun 17, 2022https://github.com/nodejs/node/issues/43456#issuecomment-1159135689
https://user-images.githubusercontent.com/469365/174355737-61d9b2de-35a5-4d3f-8627-b816d7fb049d.png
https://github.com/theanarkh
theanarkhhttps://github.com/theanarkh
on Jun 17, 2022https://github.com/nodejs/node/issues/43456#issuecomment-1159272896
https://github.com/codinbox
codinboxhttps://github.com/codinbox
on Jul 13, 2022https://github.com/nodejs/node/issues/43456#issuecomment-1183783180
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jun 25, 2026https://github.com/nodejs/node/issues/43456#issuecomment-4795119186
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jun 25, 2026https://github.com/nodejs/node/issues/43456#event-27173592048
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jul 26, 2026https://github.com/nodejs/node/issues/43456#issuecomment-5081434694
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
not plannedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Jul 26, 2026https://github.com/nodejs/node/issues/43456#event-28488556830
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/43456
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/43456
httpIssues and PRs related to the http subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.