Title: `finished(stream, cb)` invokes callback too early · Issue #32032 · nodejs/node · GitHub
Open Graph Title: `finished(stream, cb)` invokes callback too early · Issue #32032 · nodejs/node
X Title: `finished(stream, cb)` invokes callback too early · Issue #32032 · nodejs/node
Description: The semantics of finished is to invoke the callback on 'end' and 'finish'. The problem with this is that this does not mean that the stream is actually "finished", i.e. it might still emit 'error' and has probably not yet freed all resou...
Open Graph Description: The semantics of finished is to invoke the callback on 'end' and 'finish'. The problem with this is that this does not mean that the stream is actually "finished", i.e. it might still emit 'error' ...
X Description: The semantics of finished is to invoke the callback on 'end' and 'finish'. The problem with this is that this does not mean that the stream is actually "finished", i.e. it...
Opengraph URL: https://github.com/nodejs/node/issues/32032
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`finished(stream, cb)` invokes callback too early","articleBody":"The semantics of `finished` is to invoke the callback on `'end'` and `'finish'`. The problem with this is that this does not mean that the stream is actually \"finished\", i.e. it might still emit `'error'` and has probably not yet freed all resources since `'close'` is not yet emitted.\r\n\r\nThe reason we invoke it early in this way is because not all stream actually emit `'close'`. I'm a little unsure how to resolve this and whether this is worth resolving.\r\n\r\nOne way could be to use `setImmediate` or `setTimeout` before invoking the callback in `'end'`/`'finish'` in order to give a chance for `'error'` or `'close'` to be emitted. However, that is very much imperfect.\r\n\r\nWe might want to at least clarify this in the docs.\r\n\r\nThoughts? @nodejs/streams ","author":{"url":"https://github.com/ronag","@type":"Person","name":"ronag"},"datePublished":"2020-03-01T18:25:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":19},"url":"https://github.com/32032/node/issues/32032"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:27d717da-3680-f5a1-d5ba-efe368784194 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF14:5105D:591044C:7DBBF70:6A4FB218 |
| html-safe-nonce | 10bb280deb82e06bb5959f638d4e18abe7c9b944f4bb65a8f5a868f07e115d9b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjE0OjUxMDVEOjU5MTA0NEM6N0RCQkY3MDo2QTRGQjIxOCIsInZpc2l0b3JfaWQiOiI0NDgwNDk4MzM1ODAzNzQ4ODg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e637290fef1ecfb36ea87cb4c52894621ae74e8cab0369ae8b252c67f5b890bf |
| hovercard-subject-tag | issue:573591830 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/nodejs/node/32032/issue_layout |
| twitter:image | https://opengraph.githubassets.com/85e21cdf569b630e7fb0ab10d7b5a49f83774eb26c64357f1bf8cb4176310bb7/nodejs/node/issues/32032 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/85e21cdf569b630e7fb0ab10d7b5a49f83774eb26c64357f1bf8cb4176310bb7/nodejs/node/issues/32032 |
| og:image:alt | The semantics of finished is to invoke the callback on 'end' and 'finish'. The problem with this is that this does not mean that the stream is actually "finished", i.e. it might still emit 'error' ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ronag |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width