René's URL Explorer Experiment


Title: pipeline deadlock with readable tail? · Issue #40685 · nodejs/node · GitHub

Open Graph Title: pipeline deadlock with readable tail? · Issue #40685 · nodejs/node

X Title: pipeline deadlock with readable tail? · Issue #40685 · nodejs/node

Description: #40653 (comment) @lpinca feel free to edit issue and fill out with your concern. Otherwise I will dig into this at some later point. The pipeline() callback might never be called if the destination is a Transform stream that is not read....

Open Graph Description: #40653 (comment) @lpinca feel free to edit issue and fill out with your concern. Otherwise I will dig into this at some later point. The pipeline() callback might never be called if the destination...

X Description: #40653 (comment) @lpinca feel free to edit issue and fill out with your concern. Otherwise I will dig into this at some later point. The pipeline() callback might never be called if the destination...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pipeline deadlock with readable tail?","articleBody":"https://github.com/nodejs/node/pull/40653#discussion_r739873780\r\n\r\n@lpinca feel free to edit issue and fill out with your concern. Otherwise I will dig into this at some later point.\r\n\r\n---\r\n\r\nThe `pipeline()` callback might never be called if the destination is a `Transform` stream that is not read. Here is an example.\r\n\r\n```js\r\nconst stream = require('stream');\r\n\r\nconst chunk = Buffer.alloc(1024);\r\nlet bytesRead = 0;\r\n\r\nconst readable = new stream.Readable({\r\n  read() {\r\n    if (bytesRead === 100 * 1024) {\r\n      readable.push(null);\r\n    } else {\r\n      bytesRead += chunk.length;\r\n      readable.push(chunk);\r\n    }\r\n  }\r\n});\r\n\r\nconst passThrough = new stream.PassThrough();\r\n\r\nstream.pipeline(readable, passThrough, function (err) {\r\n  if (err) {\r\n    throw err;\r\n  }\r\n\r\n  console.log('done');\r\n});\r\n```\r\n\r\nIn the callback version this is not a big issue because `pipeline()` returns the last stream, so the user could resume the returned stream.\r\n\r\n```js\r\npipeline(readable, passThrough, fn).resume();\r\n```\r\n\r\nIn the promisified variant, `pipeline()` is just a wrapper that returns a promise that is fulfilled when the callback of the callback variant is called.\r\n\r\nHowever the user could not be able to resume the returned stream because they might not have direct control on it. For example if the last entry is a generator.\r\n\r\n```js\r\nconst stream = require('stream');\r\nconst streamPromises = require('stream/promises');\r\n\r\nconst chunk = Buffer.alloc(1024);\r\nlet bytesRead = 0;\r\n\r\nconst readable = new stream.Readable({\r\n  read() {\r\n    if (bytesRead === 100 * 1024) {\r\n      readable.push(null);\r\n    } else {\r\n      bytesRead += chunk.length;\r\n      readable.push(chunk);\r\n    }\r\n  }\r\n});\r\n\r\nasync function* passThrough(source) {\r\n  for await (const chunk of source) {\r\n    yield chunk;\r\n  }\r\n}\r\n\r\nasync function run() {\r\n  await streamPromises.pipeline(readable, passThrough);\r\n}\r\n\r\nrun()\r\n  .then(function () {\r\n    console.log('done');\r\n  })\r\n  .catch(console.error);\r\n```\r\n\r\nIn this case `stream.pipeline()` returns an internal `PassThrough` proxy that the user cannot resume so the promise returned by `streamPromises.pipeline()` might never be fulfilled.\r\n\r\nA possible workaround is to resume the returned stream in the promisified variant.\r\n\r\n```diff\r\ndiff --git a/lib/stream/promises.js b/lib/stream/promises.js\r\nindex 0db01a8b20..5bbadd43c5 100644\r\n--- a/lib/stream/promises.js\r\n+++ b/lib/stream/promises.js\r\n@@ -23,13 +23,17 @@ function pipeline(...streams) {\r\n       signal = options.signal;\r\n     }\r\n \r\n-    pl(streams, (err, value) => {\r\n+    const stream = pl(streams, (err, value) => {\r\n       if (err) {\r\n         reject(err);\r\n       } else {\r\n         resolve(value);\r\n       }\r\n     }, { signal });\r\n+\r\n+    if (stream.readable) {\r\n+      stream.resume();\r\n+    }\r\n   });\r\n }\r\n```","author":{"url":"https://github.com/ronag","@type":"Person","name":"ronag"},"datePublished":"2021-11-01T08:43:39Z","url":"https://github.com/nodejs/node/issues/40685"}

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:fbecfe0a-a899-6b04-0770-e72323249d50
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8A44:3EED53:7DB95:A9CAA:6AED0489
html-safe-nonce6281ff201cf1e42bef1b6ccec8c36019ebb4879481d6f78ff40fd95f24fe25b7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTQ0OjNFRUQ1Mzo3REI5NTpBOUNBQTo2QUVEMDQ4OSIsInZpc2l0b3JfaWQiOiI2NjE0OTczMDIxNzk1NzE0MTg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8535ba5bbf5a434be74a8ee2677ab96e304ae61e29d89ec4a3390a1bcc7875ba
hovercard-subject-tagissue:1040920440
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/40685/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9e1e14c44cebdf2f8994d932b587f0b2e66d8dcc98f76b58318892141d3d0891/nodejs/node/issues/40685
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9e1e14c44cebdf2f8994d932b587f0b2e66d8dcc98f76b58318892141d3d0891/nodejs/node/issues/40685
og:image:alt#40653 (comment) @lpinca feel free to edit issue and fill out with your concern. Otherwise I will dig into this at some later point. The pipeline() callback might never be called if the destination...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameronag
hostnamegithub.com
expected-hostnamegithub.com
None21e10c535436b2122cfb44c76dfb4af296e371850fb60de16776f8a64e5c3ed8
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
release302a6d707c3288a5f951258a2fa3e926b8c8f8cf
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/40685#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F40685
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%2F40685
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/40685
Reloadhttps://github.com/nodejs/node/issues/40685
Reloadhttps://github.com/nodejs/node/issues/40685
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues654 (654)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/40685
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/40685
#65559https://github.com/nodejs/node/pull/65559
oven-sh/bun#45982https://github.com/oven-sh/bun/pull/45982
pipeline deadlock with readable tail?https://github.com/nodejs/node/issues/40685#top
#65559https://github.com/nodejs/node/pull/65559
oven-sh/bun#45982https://github.com/oven-sh/bun/pull/45982
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
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%22
https://github.com/ronag
ronaghttps://github.com/ronag
on Nov 1, 2021https://github.com/nodejs/node/issues/40685#issue-1040920440
#40653 (comment)https://github.com/nodejs/node/pull/40653#discussion_r739873780
@lpincahttps://github.com/lpinca
ronaghttps://github.com/ronag
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%22
on Nov 1, 2021https://github.com/nodejs/node/issues/40685#event-5547480699
https://github.com/romayalon
romayalonhttps://github.com/romayalon
on Jan 16, 2022https://github.com/nodejs/node/issues/40685#issuecomment-1013902734
https://github.com/trivikr
trivikrhttps://github.com/trivikr
on May 20, 2026https://github.com/nodejs/node/issues/40685#issuecomment-4494954206
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Aug 19, 2026https://github.com/nodejs/node/issues/40685#issuecomment-5336427874
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 Aug 19, 2026https://github.com/nodejs/node/issues/40685#event-29655394452
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Sep 19, 2026https://github.com/nodejs/node/issues/40685#issuecomment-5738241000
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 Sep 19, 2026https://github.com/nodejs/node/issues/40685#event-31428885399
nodejs-github-bothttps://github.com/nodejs-github-bot
on Sep 26, 2026https://github.com/nodejs/node/issues/40685#event-31903624994
stream: fix pipeline function tail deadlockhttps://github.com/nodejs/node/commit/31e841f05633513db165eeaa8f51986d6932f8ca
31e841fhttps://github.com/nodejs/node/commit/31e841f05633513db165eeaa8f51986d6932f8ca
aduh95https://github.com/aduh95
on Sep 27, 2026https://github.com/nodejs/node/issues/40685#event-31936996947
stream: fix pipeline function tail deadlockhttps://github.com/nodejs/node/commit/4ac603fc970ead31b1df32b233c531284e78e0aa
4ac603fhttps://github.com/nodejs/node/commit/4ac603fc970ead31b1df32b233c531284e78e0aa
HoonDongKanghttps://github.com/HoonDongKang
on Sep 28, 2026https://github.com/nodejs/node/issues/40685#event-31971108355
stream: fix pipeline function tail deadlockhttps://github.com/HoonDongKang/node/commit/0b3d7ec7948bca581215c5937b94ee11843f3a49
0b3d7echttps://github.com/HoonDongKang/node/commit/0b3d7ec7948bca581215c5937b94ee11843f3a49
aduh95https://github.com/aduh95
on Sep 28, 2026https://github.com/nodejs/node/issues/40685#event-32031890875
stream: fix pipeline function tail deadlockhttps://github.com/nodejs/node/commit/dcc8665f7eca3233193f7cb79746c955c3bf93b6
dcc8665https://github.com/nodejs/node/commit/dcc8665f7eca3233193f7cb79746c955c3bf93b6
aduh95https://github.com/aduh95
on Oct 23, 2026https://github.com/nodejs/node/issues/40685#event-34094384769
stream: fix pipeline function tail deadlockhttps://github.com/nodejs/node/commit/90f36fb28db7623588790bf9a056dbf2dd03124f
90f36fbhttps://github.com/nodejs/node/commit/90f36fb28db7623588790bf9a056dbf2dd03124f
stream: fix pipeline function tail deadlockhttps://github.com/nodejs/node/commit/c228ab17ce41c5b0d7e236b1f304df26dad85903
c228ab1https://github.com/nodejs/node/commit/c228ab17ce41c5b0d7e236b1f304df26dad85903
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/40685
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/40685
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
streamIssues and PRs related to Node.js streams.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stream%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.