-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: always invoke end(cb) callback #29747
Conversation
e57bf46
to
a7008cd
Compare
64bf430
to
9a45936
Compare
@nodejs/streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, out of precaution I would mark this semver-major.
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/2022/ (queued) |
I'm worried about https://www.npmjs.com/package/csv-parser failing on CITGM |
csv-parser fails in all recent CITGM runs. It's not related to this change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change has an interesting side effect, and I think we should try to avoid it. Calling stream.end('hello', cb)
is going to prevent the error to bubble up to 'uncaughtException'
if there are no other 'error'
handlers.
You might want to re-emit the error if there are no other 'error'
listeners.
Excellent point. I'll take care of it. |
1c093e6
to
35f00ac
Compare
For anyone following along in the conversation: csv-parser should be fixed by sindresorhus/execa#370 and is indeed unrelated to these changes |
Found another case where the callback is not called. Fixed. |
4f42666
to
fc45bf8
Compare
c399fe1
to
aee2077
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Relevant test failures in test.parallel/test-stream-transform-final-sync and test.parallel/test-stream-transform-final. |
@Trott: My mistake. Should be fixed now. |
@nodejs/tsc this needs some review |
@Trott: This needs TSC review (see Matteo's comment)? Can we put tsc label on this or how does that work? |
I think @mcollina just meant that this is |
Ensure that the callback passed into end() is always invoke in order to avoid bug such as deadlock the user. PR-URL: #29747 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Landed in 9d09969 |
Ensure that the callback passed into end() is always invoked in order to avoid bug such as deadlock the user.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes