René's URL Explorer Experiment


Title: Cannot CONNECT http2-over-http2 in Node 20.12.0 · Issue #52344 · nodejs/node · GitHub

Open Graph Title: Cannot CONNECT http2-over-http2 in Node 20.12.0 · Issue #52344 · nodejs/node

X Title: Cannot CONNECT http2-over-http2 in Node 20.12.0 · Issue #52344 · nodejs/node

Description: Version v20.12.0 Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem http2 What steps will reproduce the bug? Test-suite ready demo: 'use strict'; const comm...

Open Graph Description: Version v20.12.0 Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem http2 What steps will reproduce the bug? Test-su...

X Description: Version v20.12.0 Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem http2 What steps will reproduce the bug? Test-su...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot CONNECT http2-over-http2 in Node 20.12.0","articleBody":"### Version\n\nv20.12.0\n\n### Platform\n\nLinux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux\n\n### Subsystem\n\nhttp2\n\n### What steps will reproduce the bug?\n\nTest-suite ready demo:\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst common = require('../common');\r\nconst assert = require('assert');\r\nconst h2 = require('http2');\r\n\r\nconst server = h2.createServer();\r\n\r\nserver.listen(0, common.mustCall(function() {\r\n  const proxyClient = h2.connect(`http://localhost:${server.address().port}`);\r\n\r\n  const request = proxyClient.request({\r\n    ':method': 'CONNECT',\r\n    ':authority': 'example.com:80'\r\n  });\r\n\r\n  request.on('response', common.mustCall((connectResponse) => {\r\n    assert.strictEqual(connectResponse[':status'], 200);\r\n\r\n    const proxiedClient = h2.connect('http://example.com', {\r\n      createConnection: () => request // Tunnel via first request stream\r\n    });\r\n\r\n    const proxiedRequest = proxiedClient.request();\r\n    proxiedRequest.on('response', common.mustCall((proxiedResponse) => {\r\n      assert.strictEqual(proxiedResponse[':status'], 204);\r\n\r\n      proxiedClient.close();\r\n      proxyClient.close();\r\n      server.close();\r\n    }));\r\n  }));\r\n}));\r\n\r\nserver.once('connect', common.mustCall((req, res) => {\r\n  assert.strictEqual(req.headers[':method'], 'CONNECT');\r\n  res.writeHead(200); // Accept the CONNECT tunnel\r\n\r\n  // Handle this stream as a new 'proxied' connection (pretend to forward\r\n  // but actually just unwrap the tunnel ourselves):\r\n  server.emit('connection', res.stream);\r\n}));\r\n\r\n// Handle the 'proxied' request itself:\r\nserver.once('request', common.mustCall((req, res) => {\r\n  res.writeHead(204);\r\n  res.end();\r\n}));\r\n```\n\n### How often does it reproduce? Is there a required condition?\n\nFails every time in Node v20.12.\r\n\r\nWorks every time in Node v20.11 and previous releases (for a few years, at least)\n\n### What is the expected behavior? Why is that the expected behavior?\n\nIt should be possible to make an HTTP/2 CONNECT request (opening a tunnel to a target server through an HTTP/2 proxy) and then make another HTTP/2 request to the target server.\n\n### What do you see instead?\n\nInstead, creating an HTTP/2 connection on top of an HTTP/2 tunnel fails with:\r\n\r\n```javascript\r\nError [ERR_HTTP2_SOCKET_BOUND]: The socket is already bound to an Http2Session\r\n    at new Http2Session (node:internal/http2/core:1238:13)\r\n    at new ServerHttp2Session (node:internal/http2/core:1640:5)\r\n    at Http2Server.connectionListener (node:internal/http2/core:3102:19)\r\n    at Http2Server.emit (node:events:518:28)\r\n    at Http2Server.\u003canonymous> (/home/tim/Dropbox/programming/javascript/node/test/parallel/test-http2-client-proxy-over-http2.js:41:10)\r\n    at Http2Server.\u003canonymous> (/home/tim/Dropbox/programming/javascript/node/test/common/index.js:473:15)\r\n    at Object.onceWrapper (node:events:633:26)\r\n    at Http2Server.emit (node:events:518:28)\r\n    at Http2Server.onServerStream (node:internal/http2/compat:956:17)\r\n    at Http2Server.emit (node:events:518:28) {\r\n  code: 'ERR_HTTP2_SOCKET_BOUND'\r\n}\r\n```\n\n### Additional information\n\nI'm fairly sure I know the issue here: `kSession` is used in the HTTP/2 code as a single symbol with two meanings:\r\n\r\n* On sockets, marking them as being owned by an HTTP/2 session (i.e. there is a session currently running within this socket)\r\n* On HTTP/2 streams, providing access to the HTTP/2 session that contains them (i.e. this stream is running within that session)\r\n\r\nIn this case, these two meanings mix: the CONNECT stream should be within an HTTP/2 session (the initial connection) _and_ should act as a socket and contain an HTTP/2 session. That conflict is why this blows up.\r\n\r\nThis didn't happen in the past because the inner stream uses a JSStreamSocket to handle this, and kSession wasn't passed through that wrapper, so the JSS and the inner H2 stream had independent kSession values. That changed in https://github.com/nodejs/node/commit/c50524a9fc19cd2fe6e61bb7f8ad22685024842b#diff-8dd7127678f00bf090a030256bad7ae645834f7100e54154b4fc81c8cbe9c3fc, which (reasonably I think) exposed the 'real' kSession through that wrapper.\r\n\r\nI think the solution here is two split these two use cases, and track the 'socket-in-use-by' and 'stream-powered-by' state under separate keys, so a single H2 stream can have both. I'm going to keep digging and hopefully open a PR for this within a day or two, but if anybody has any context on that in the meantime and whether this is going to work or whether there's a good reason the two are the same, that would be very interesting.","author":{"url":"https://github.com/pimterry","@type":"Person","name":"pimterry"},"datePublished":"2024-04-03T11:50:38Z","url":"https://github.com/nodejs/node/issues/52344"}

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:7c2fed7a-a488-297b-fce5-fe47829deb1d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC7F0:2C3014:660F7D:846421:6AED2C1B
html-safe-nonce3c00819bb101092eaa56d2924e9ec0c264eb146c350776eb9eab4bd5b9e84131
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDN0YwOjJDMzAxNDo2NjBGN0Q6ODQ2NDIxOjZBRUQyQzFCIiwidmlzaXRvcl9pZCI6IjI4Njk2Mjc2NjU1NTMxMDc5OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac65c17399f92b327c084c4c626aa934b1d11020426f20f00c3ce6656324520a8e
hovercard-subject-tagissue:2222720722
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/52344/issue_layout
twitter:imagehttps://opengraph.githubassets.com/715e05b8740923d1bdcc237a5ec7a1af6ad91688cb4b94253f51e2b68795973b/nodejs/node/issues/52344
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/715e05b8740923d1bdcc237a5ec7a1af6ad91688cb4b94253f51e2b68795973b/nodejs/node/issues/52344
og:image:altVersion v20.12.0 Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem http2 What steps will reproduce the bug? Test-su...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepimterry
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/52344#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F52344
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%2F52344
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/52344
Reloadhttps://github.com/nodejs/node/issues/52344
Reloadhttps://github.com/nodejs/node/issues/52344
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/52344
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/52344
#52368https://github.com/nodejs/node/pull/52368
Cannot CONNECT http2-over-http2 in Node 20.12.0https://github.com/nodejs/node/issues/52344#top
#52368https://github.com/nodejs/node/pull/52368
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
https://github.com/pimterry
pimterryhttps://github.com/pimterry
on Apr 3, 2024https://github.com/nodejs/node/issues/52344#issue-2222720722
#21https://github.com/nodejs/node/pull/21
c50524a#diff-8dd7127678f00bf090a030256bad7ae645834f7100e54154b4fc81c8cbe9c3fchttps://github.com/nodejs/node/commit/c50524a9fc19cd2fe6e61bb7f8ad22685024842b#diff-8dd7127678f00bf090a030256bad7ae645834f7100e54154b4fc81c8cbe9c3fc
VoltrexKeyvahttps://github.com/VoltrexKeyva
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
on Apr 3, 2024https://github.com/nodejs/node/issues/52344#event-12348323069
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#52368https://github.com/nodejs/node/pull/52368
on Apr 8, 2024https://github.com/nodejs/node/issues/52344#event-12390093504
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/52344
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/52344
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%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.