René's URL Explorer Experiment


Title: Network request fails after event loop is blocked for a few seconds (regression in v20) · Issue #54293 · nodejs/node · GitHub

Open Graph Title: Network request fails after event loop is blocked for a few seconds (regression in v20) · Issue #54293 · nodejs/node

X Title: Network request fails after event loop is blocked for a few seconds (regression in v20) · Issue #54293 · nodejs/node

Description: Version v20.16.0 Platform Darwin MacBook.my.network 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul 5 17:54:52 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8103 arm64 Subsystem http What steps will reproduce the bug? Block the event loop...

Open Graph Description: Version v20.16.0 Platform Darwin MacBook.my.network 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul 5 17:54:52 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8103 arm64 Subsystem http What steps will...

X Description: Version v20.16.0 Platform Darwin MacBook.my.network 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul 5 17:54:52 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8103 arm64 Subsystem http What steps will...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Network request fails after event loop is blocked for a few seconds (regression in v20)","articleBody":"### Version\r\n\r\nv20.16.0\r\n\r\n### Platform\r\n\r\n```text\r\nDarwin MacBook.my.network 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul  5 17:54:52 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8103 arm64\r\n```\r\n\r\n\r\n### Subsystem\r\n\r\nhttp\r\n\r\n### What steps will reproduce the bug?\r\n\r\n1. Block the event loop for 10 seconds via a long-running operation\r\n2. Make a network request via `http.request()`\r\n\r\nCode example:\r\n\r\n```js\r\nconst http = require(\"node:http\");\r\n\r\nconst makePostRequest = () =>\r\n  new Promise((resolve, reject) => {\r\n    const onResponse = (res) => {\r\n      let data = \"\";\r\n\r\n      res.on(\"data\", (chunk) => {\r\n        data += chunk;\r\n      });\r\n\r\n      res.on(\"end\", () => resolve(data));\r\n    };\r\n\r\n    const req = http.request(\r\n      \"http://127.0.0.1:3000/\",\r\n      { method: \"POST\" },\r\n      onResponse,\r\n    );\r\n\r\n    req.on(\"error\", (e) => reject(e));\r\n\r\n    req.end();\r\n  });\r\n\r\nconst makeRequests = async () => {\r\n  await makePostRequest();\r\n\r\n  console.log(\"First request worked\");\r\n\r\n  const timestamp = Date.now();\r\n\r\n  // Block the event loop for 10 seconds\r\n  while (Date.now() \u003c timestamp + 10000);\r\n\r\n  // Enable the following line and it will work:\r\n  // await new Promise((resolve) => setTimeout(resolve, 10));\r\n\r\n  await makePostRequest();\r\n\r\n  console.log(\"It crashes before it gets here\");\r\n};\r\n\r\nconst server = http.createServer((req, res) => {\r\n  console.log(\"Request received\");\r\n  res.statusCode = 200;\r\n  res.setHeader(\"Content-Type\", \"text/plain\");\r\n  res.end(\"Hello world!\\n\");\r\n});\r\n\r\nserver.listen(3000, \"127.0.0.1\", () => {\r\n  console.log(\"Server up\");\r\n\r\n  makeRequests();\r\n});\r\n\r\n```\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nReproduces always.\r\n\r\n### What is the expected behavior? Why is that the expected behavior?\r\n\r\nThe network request works.\r\n\r\n### What do you see instead?\r\n\r\n1. The network request fails with `ECONNRESET`.\r\n2. The network request does not reach the server.\r\n\r\nLog from running the code above:\r\n\r\n```\r\nServer up\r\nRequest received\r\nFirst request worked\r\nnode:internal/process/promises:391\r\n    triggerUncaughtException(err, true /* fromPromise */);\r\n    ^\r\n\r\nError: read ECONNRESET\r\n    at TCP.onStreamRead (node:internal/stream_base_commons:218:20) {\r\n  errno: -54,\r\n  code: 'ECONNRESET',\r\n  syscall: 'read'\r\n}\r\n\r\nNode.js v20.16.0\r\n\r\nProcess finished with exit code 1\r\n```\r\n\r\n### Additional information\r\n\r\nThis is a regression. The code works on Node.js 18. It fails on Node.js 20.\r\n\r\nIf we wait for 10ms before running the network request, it works.","author":{"url":"https://github.com/nikwen","@type":"Person","name":"nikwen"},"datePublished":"2024-08-09T22:41:24Z","url":"https://github.com/nodejs/node/issues/54293"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3d02464a-6773-c48e-88dd-faddec69455f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCA82:1FD7D4:417322:580718:6B061E6B
html-safe-nonce64c6064c396a5d573f4a4c5e5f01c3e13e071773eb639023b533fdcf3568f2cb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTgyOjFGRDdENDo0MTczMjI6NTgwNzE4OjZCMDYxRTZCIiwidmlzaXRvcl9pZCI6IjI0NjI2Mzg2MzkwNTQ5ODY4NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca09399b0abcb8401a2f1b39dd38c918bae45f00dc84a054097db17845d229940
hovercard-subject-tagissue:2458753115
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/54293/issue_layout
twitter:imagehttps://opengraph.githubassets.com/895d66bb27f01069b0aab43c76cff4cef4a375d68703de01de469316bba4285d/nodejs/node/issues/54293
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/895d66bb27f01069b0aab43c76cff4cef4a375d68703de01de469316bba4285d/nodejs/node/issues/54293
og:image:altVersion v20.16.0 Platform Darwin MacBook.my.network 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul 5 17:54:52 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T8103 arm64 Subsystem http What steps will...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenikwen
hostnamegithub.com
expected-hostnamegithub.com
None9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d
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
releaseb25c3080e84402f75431d8dc7a96b2635219cec7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/54293#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F54293
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%2F54293
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/54293
Reloadhttps://github.com/nodejs/node/issues/54293
Reloadhttps://github.com/nodejs/node/issues/54293
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues630 (630)https://github.com/nodejs/node/issues
Pull requests660 (660)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/insights
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54293
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54293
Network request fails after event loop is blocked for a few seconds (regression in v20)https://github.com/nodejs/node/issues/54293#top
httphttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%22
https://github.com/nikwen
nikwenhttps://github.com/nikwen
on Aug 9, 2024https://github.com/nodejs/node/issues/54293#issue-2458753115
Nexthttps://github.com/nodejs/node/issues/54293?timeline_page=1
avivkellerhttps://github.com/avivkeller
httphttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%22
repro-existshttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22repro-exists%22
on Aug 9, 2024https://github.com/nodejs/node/issues/54293#event-13826254353
https://github.com/avivkeller
avivkellerhttps://github.com/avivkeller
on Aug 9, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2278860819
https://github.com/trivikr
trivikrhttps://github.com/trivikr
on Aug 10, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2279492225
https://github.com/jazelly
jazellyhttps://github.com/jazelly
on Aug 10, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2282181337
this PRhttps://github.com/nodejs/node/pull/43522/files#:~:text=globalAgent%3A%20new%20Agent(%7B%20keepAlive%3A%20true%2C%20scheduling%3A%20%27lifo%27%2C%20timeout%3A%205000%20%7D)
https://github.com/nikwen
nikwenhttps://github.com/nikwen
on Aug 11, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2282780016
@jazellyhttps://github.com/jazelly
https://github.com/jazelly
jazellyhttps://github.com/jazelly
on Aug 22, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2303490969
RFC 9112 standardhttps://httpwg.org/specs/rfc9112.html#persistent.connections:~:text=To%20avoid%20the%20TCP,fully%20closes%20the%20connection.
https://github.com/jakecastelli
jakecastellihttps://github.com/jakecastelli
on Aug 25, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2308780535
@jazellyhttps://github.com/jazelly
herehttps://github.com/nodejs/undici/issues/3492
jakecastellihttps://github.com/jakecastelli
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 25, 2024https://github.com/nodejs/node/issues/54293#event-14004001906
https://github.com/nikwen
nikwenhttps://github.com/nikwen
on Aug 26, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2311112013
@jakecastellihttps://github.com/jakecastelli
@jazellyhttps://github.com/jazelly
https://github.com/jazelly
jazellyhttps://github.com/jazelly
on Aug 28, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2315038534
this PRhttps://github.com/nodejs/node/pull/52653
https://github.com/nikwen
nikwenhttps://github.com/nikwen
on Aug 28, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2315058596
@jazellyhttps://github.com/jazelly
https://github.com/jazelly
jazellyhttps://github.com/jazelly
on Aug 28, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2315118030
https://github.com/nikwen
nikwenhttps://github.com/nikwen
on Aug 28, 2024https://github.com/nodejs/node/issues/54293#issuecomment-2315284347
@jazellyhttps://github.com/jazelly
jasnellhttps://github.com/jasnell
on Sep 13, 2024https://github.com/nodejs/node/issues/54293#event-14250885548
http: reduce likelihood of race conditions on keep-alive timeouthttps://github.com/nodejs/node/commit/05ad94789916563664acb666a7ac367fd8b2cc8b
05ad947https://github.com/nodejs/node/commit/05ad94789916563664acb666a7ac367fd8b2cc8b
targoshttps://github.com/targos
on Sep 22, 2024https://github.com/nodejs/node/issues/54293#event-14354404936
http: reduce likelihood of race conditions on keep-alive timeouthttps://github.com/nodejs/node/commit/db524d861446a9135f09b2ee91072917a73c8abb
db524d8https://github.com/nodejs/node/commit/db524d861446a9135f09b2ee91072917a73c8abb
http: reduce likelihood of race conditions on keep-alive timeouthttps://github.com/nodejs/node/commit/a2eff023de0ce06530cc7e6e817e5cf4d1a56218
a2eff02https://github.com/nodejs/node/commit/a2eff023de0ce06530cc7e6e817e5cf4d1a56218
http: reduce likelihood of race conditions on keep-alive timeouthttps://github.com/nodejs/node/commit/4990ac89f02380499ed1183278259bc1c2daab8a
4990ac8https://github.com/nodejs/node/commit/4990ac89f02380499ed1183278259bc1c2daab8a
http: reduce likelihood of race conditions on keep-alive timeouthttps://github.com/nodejs/node/commit/596940cfa098fb5e9bf6d187096c21d482b10bdd
596940chttps://github.com/nodejs/node/commit/596940cfa098fb5e9bf6d187096c21d482b10bdd
dennevhttps://github.com/dennev
on Nov 6, 2026https://github.com/nodejs/node/issues/54293#event-35319872757
http: do not reuse expired free socketshttps://github.com/dennev/node/commit/5bb30c378ff4bb821363bce0681323c431f3f937
5bb30c3https://github.com/dennev/node/commit/5bb30c378ff4bb821363bce0681323c431f3f937
http: do not reuse expired free socketshttps://github.com/dennev/node/commit/f9ed8964fe6dbd14a5ad455fa362d3f1c6ac4e8e
f9ed896https://github.com/dennev/node/commit/f9ed8964fe6dbd14a5ad455fa362d3f1c6ac4e8e
dennevhttps://github.com/dennev
on Nov 21, 2026https://github.com/nodejs/node/issues/54293#event-36854634717
http: do not reuse expired free socketshttps://github.com/dennev/node/commit/646483f499ba64812885983962d662cd06c0139b
646483fhttps://github.com/dennev/node/commit/646483f499ba64812885983962d662cd06c0139b
nodejs-github-bothttps://github.com/nodejs-github-bot
on Nov 23, 2026https://github.com/nodejs/node/issues/54293#event-37053654315
http: do not reuse expired free socketshttps://github.com/nodejs/node/commit/642300f7aa7fc168dbb7805a3303ec87f599e50d
642300fhttps://github.com/nodejs/node/commit/642300f7aa7fc168dbb7805a3303ec87f599e50d
aduh95https://github.com/aduh95
on Nov 24, 2026https://github.com/nodejs/node/issues/54293#event-37108757777
http: do not reuse expired free socketshttps://github.com/nodejs/node/commit/5b15842d98ca35ae0ecfd4b2096b61d14e6d61ee
5b15842https://github.com/nodejs/node/commit/5b15842d98ca35ae0ecfd4b2096b61d14e6d61ee
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/54293
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54293
httphttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http%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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.