René's URL Explorer Experiment


Title: http: client stops forwarding socket `'drain'` to the request once the response is complete · Issue #67763 · nodejs/node · GitHub

Open Graph Title: http: client stops forwarding socket `'drain'` to the request once the response is complete · Issue #67763 · nodejs/node

X Title: http: client stops forwarding socket `'drain'` to the request once the response is complete · Issue #67763 · nodejs/node

Description: Version v20.20.2, v22.23.5, v24.22.3, v26.13.1 (all tested versions) Platform Linux 192.168.1.15 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 16:33:25 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux (It must be noted this is th...

Open Graph Description: Version v20.20.2, v22.23.5, v24.22.3, v26.13.1 (all tested versions) Platform Linux 192.168.1.15 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 16:33:25 UTC 2026 x86_64 x86_64 x86_6...

X Description: Version v20.20.2, v22.23.5, v24.22.3, v26.13.1 (all tested versions) Platform Linux 192.168.1.15 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 16:33:25 UTC 2026 x86_64 x86_64 x86_6...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http: client stops forwarding socket `'drain'` to the request once the response is complete","articleBody":"### Version\n\nv20.20.2, v22.23.5, v24.22.3, v26.13.1 (all tested versions)\n\n### Platform\n\n```text\nLinux 192.168.1.15 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 16:33:25 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux\n\n(It must be noted this is the Hosts' command. The replication is done inside a Podman Container)\n```\n\n### Subsystem\n\nhttp\n\n### What steps will reproduce the bug?\n\nThe server answers as soon as it has the request headers, while the client is still writing a body with backpressure:\n\n```js\n'use strict';\n// node repro.js        -> request never finishes (exit 1)\n// node repro.js fix    -> forwards the socket's 'drain' to the request (exit 0)\nconst http = require('node:http');\nconst FIX = process.argv[2] === 'fix';\nconst BODY = 8 * 1024 * 1024;\n\nconst srv = http.createServer((q, r) => { r.writeHead(201, { 'Content-Length': '0' }); r.end(); q.resume(); });\nsrv.listen(0, '127.0.0.1', () => {\n  const req = http.request({ port: srv.address().port, method: 'PUT', path: '/', headers: { 'Content-Length': BODY } }, (res) => {\n    if (FIX) req.socket.on('drain', () => req.emit('drain'));\n    res.resume();\n    res.on('end', () => setTimeout(() => {\n      console.log(`node ${process.version} fix=${FIX}: writableFinished=${req.writableFinished} writableNeedDrain=${req.writableNeedDrain}`);\n      process.exit(req.writableFinished ? 0 : 1);\n    }, 1500));\n  });\n  const chunk = Buffer.alloc(64 * 1024, 7);\n  let left = BODY;\n  (function write() {\n    while (left > 0) {\n      const n = Math.min(left, chunk.length); left -= n;\n      if (!req.write(chunk.subarray(0, n))) return req.once('drain', write);\n    }\n    req.end();\n  })();\n});\n```\n\n\n### How often does it reproduce? Is there a required condition?\n\nAlways with the script above. The required condition is that the response is completely parsed while the request is still waiting for `'drain'`.\n\nWith a server that replies only after reading the whole body, the same state is reachable over HTTPS. There, the completion of the final write is reported one event-loop turn later, and the response can be parsed in that gap. On v26.11.0+ this happens in normal use because of #XXXXX. With 22 concurrent 8 MiB `PUT`s over one keep-alive HTTPS agent and the client pinned to one CPU, 6 of 110 requests hung on v26.13.1.\n\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```\nnode v26.13.1 fix=false: writableFinished=true writableNeedDrain=false\n```\n\nA request that is still writing its body should keep receiving `'drain'` from its socket until it has ended, whether or not the response has already arrived. Otherwise any writer that honors backpressure, including `stream.pipe(req)`, can never finish the request.\n\n\n### What do you see instead?\n\n```\nnode v26.13.1 fix=false: writableFinished=false writableNeedDrain=true\n```\n\nThe request never finishes, `writableNeedDrain` stays `true`, and the socket stays in flight, which keeps the process alive.\n\n\n### Additional information\n\nIn `lib/_http_client.js`, `socketOnData()` calls `socket.removeListener('drain', ondrain)` as soon as `parser.incoming.complete` is set, without checking whether the request still has `kNeedDrain` set. `responseOnEnd()` does not release the socket in this state, because `req.writableFinished` is `false`, so the socket stays referenced indefinitely.\n\nI have a patch, with a test, that keeps `ondrain` attached until the request has ended and removes it in `responseKeepAlive()`. I can open a PR.\n\n## AI Disclaimer\n\nThis report was made almost entirely with an AI. With the exception of this precise disclaimer.\nIn particular, this was a bug I found in production for our local infrastructure, where CI runs in a self-hosted Forgejo, and a Forgejo Runner, suddenly hung when using forgejo/upload-artifacts@v4 and @v5 with a ~200MB artifact, despite everything working with @v3, and in earlier versions of node.\n\nFor now we are reverting to @v3, but I am obviously notifying the maintainers of the forgejo runner so this can be worked around upstream.\n\nThe AI agent has made a patch that schedules `endReadable()` in `flowSync()` under the same condition as `read()`, with a test.\n\nI don't post a PR, because the AI contribution guidelines specify that the user proposing a PR must fully understand the changes, which I don't yet fully. Thus I post the patch and other relevant files, so the maintainers can check its accuracy, and maybe implement their own patch/test if needed\n\nI am open to any other data that might be needed to clarify the situation, to the best of my ability.\n\nFound at the same time as issue #67762\n\n[0002-http-keep-forwarding-drain-after-response-completes.patch](https://github.com/user-attachments/files/35374205/0002-http-keep-forwarding-drain-after-response-completes.patch)","author":{"url":"https://github.com/AZMCode","@type":"Person","name":"AZMCode"},"datePublished":"2026-11-24T20:34:52Z","url":"https://github.com/nodejs/node/issues/67763"}

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:aec5bd10-5f6f-3919-91c3-b58087861d95
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDD06:30F58B:3CDEBF:4FF191:6B0619A1
html-safe-nonce5273b35783c85c130c642da5337bfbee01ff5f5d7ae3295f2833e9febedb8f7a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDA2OjMwRjU4QjozQ0RFQkY6NEZGMTkxOjZCMDYxOUExIiwidmlzaXRvcl9pZCI6IjM5NjI0MzU4NTAxMDkwNjU2MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8da69e1af571b220862a8b19c326f9cef0a055e4854a5a5faa2cd121d59a6a00
hovercard-subject-tagissue:6590885653
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/67763/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7737d83f4406c327a235153a0e0e0928aecf2a35cd7713bb90a8e2931e78dd2a/nodejs/node/issues/67763
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7737d83f4406c327a235153a0e0e0928aecf2a35cd7713bb90a8e2931e78dd2a/nodejs/node/issues/67763
og:image:altVersion v20.20.2, v22.23.5, v24.22.3, v26.13.1 (all tested versions) Platform Linux 192.168.1.15 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 16:33:25 UTC 2026 x86_64 x86_64 x86_6...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAZMCode
hostnamegithub.com
expected-hostnamegithub.com
None97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374
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
release866f202ebf7ac5aff8f633417d9fd8a53818a977
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/67763#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F67763
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%2F67763
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/67763
Reloadhttps://github.com/nodejs/node/issues/67763
Reloadhttps://github.com/nodejs/node/issues/67763
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues630 (630)https://github.com/nodejs/node/issues
Pull requests659 (659)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/67763
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67763
http: client stops forwarding socket 'drain' to the request once the response is completehttps://github.com/nodejs/node/issues/67763#top
https://github.com/AZMCode
AZMCodehttps://github.com/AZMCode
on Nov 24, 2026https://github.com/nodejs/node/issues/67763#issue-6590885653
@v5https://github.com/v5
@V3https://github.com/V3
@V3https://github.com/V3
#67762https://github.com/nodejs/node/issues/67762
0002-http-keep-forwarding-drain-after-response-completes.patchhttps://github.com/user-attachments/files/35374205/0002-http-keep-forwarding-drain-after-response-completes.patch
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/67763
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67763
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.