Title: stream: recompute the close error when eos() defers by bitpshr · Pull Request #65689 · nodejs/node · GitHub
Open Graph Title: stream: recompute the close error when eos() defers by bitpshr · Pull Request #65689 · nodejs/node
X Title: stream: recompute the close error when eos() defers by bitpshr · Pull Request #65689 · nodejs/node
Description: Fixes: #65677 Great report, the analysis in the issue is spot on and made this easy to confirm. When eos() runs against a stream that has already closed, it computed the premature close error immediately and then delivered it on the next tick. A closed stream can still be holding its whole body in the readable buffer, so anything that drains that buffer in between, such as async iteration starting up, leaves the callback reporting a state that no longer applies. An HTTP/2 response that was fully buffered before the stream closed normally fails with ERR_STREAM_PREMATURE_CLOSE. This recomputes the result inside the deferred callback instead, which is what the 'close' handler further down the same file already does. Only the already-closed branch is affected. The other branches capture an error that was already emitted, so they cannot go stale, and the synchronous callback path returns before the tick. Verification, since this sits under a lot of streams: The reproduction from the issue goes from ERR_STREAM_PREMATURE_CLOSE to passing, and v22 passes it both ways as a control. The added regression test fails on an unpatched build with exactly ERR_STREAM_PREMATURE_CLOSE, so it is not passing vacuously. Full parallel and sequential runs on patched and unpatched builds produced nearly disjoint failure sets, 9 unique to patched and 14 unique to baseline, with only a local fixture issue common to both. The unpatched run failed more tests than the patched one. A handful of TLS tests appeared in the patched run, so I ran those five six more times against the patched build and they passed every time. Worth flagging that the reporter suspects #62394 / cbee0de as the origin, which matches the version boundary in their table, so v24.x and v26.x are likely to want this too.
Open Graph Description: Fixes: #65677 Great report, the analysis in the issue is spot on and made this easy to confirm. When eos() runs against a stream that has already closed, it computed the premature close error immed...
X Description: Fixes: #65677 Great report, the analysis in the issue is spot on and made this easy to confirm. When eos() runs against a stream that has already closed, it computed the premature close error immed...
Opengraph URL: https://github.com/nodejs/node/pull/65689
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8151baee-4968-32a6-e1db-39ef710b8ff3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CCE2:14E440:B61BB6:E6AF12:6B036DFE |
| html-safe-nonce | f8bb74e8d6eaa4d2d896f0c045d06fe620ef08c92841df15508c56750fb5096c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0UyOjE0RTQ0MDpCNjFCQjY6RTZBRjEyOjZCMDM2REZFIiwidmlzaXRvcl9pZCI6IjM2NjYyOTk0Mzk4OTI2MjI4NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f5123e4646644caae01e88b73ff6e32f897bfdee167920db2678189f133f1627 |
| hovercard-subject-tag | pull_request:4405511919 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodejs/node/pull/65689/files |
| twitter:image | https://avatars.githubusercontent.com/u/334586?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/334586?s=400&v=4 |
| og:image:alt | Fixes: #65677 Great report, the analysis in the issue is spot on and made this easy to confirm. When eos() runs against a stream that has already closed, it computed the premature close error immed... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width