-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
pipeline
leaves a hanging error handler
#35452
Comments
This is by design. |
The docs say:
|
Can this design be improved? Or is this a no? |
Hmmm |
/cc @nodejs/streams |
I don’t think there is anything more to do here. Unless someone has suggestion? |
@ronag I agree. Using |
It does not. |
I missed that the last stream in the example is a duplex stream. Not sure how that should behave, because the readable side can't be consumed. |
What do you mean? |
If it were If we swap the duplex stream in your example for a writable stream, then it does get destroyed: const {pipeline, PassThrough, Writable} = require('stream')
const a = new PassThrough()
a.end('foobar')
const b = new Writable({
write (chunk, encoding, callback) {
callback()
}
})
pipeline(a, b, function (err) {
if (err) {
throw err
}
console.log(a.destroyed) // true
console.log(b.destroyed) // true
}) |
You don't know. It's readable so it's not destroyed. Something can be reading it a tick later. |
Removing the error handler on the last (returned) stream might make sense if it is readable. @nodejs/streams wdyt? |
I'm ok in removing it when we do not call stream.destroy(). |
@szmarczak would you like to prepare a PR? |
Sure, would love to. |
@szmarczak any updates here? |
Sorry, totally forgot about this one. Will sketch something in a few hours. |
Count on me to help! @szmarczak |
@joaoofreitas awesome! Feel free to send a PR first and I'll chime in and let you know my thoughts :D |
If this is still work in progress I'd be happy to help |
Sure thing! |
@Heikrana this might end up a bit too hard. Maybe try something easier first? It's one of the hardest part of Node. |
Okay, I see your point. I've been trying to understand the stream API and yeah, it's a bit confusing. But in the meantime, can you suggest me some resources (which would help me contribute to NodeJS) or another issue which might be more of my level. I really want to be part of this community :) |
fix: #35452 PR-URL: #41954 Fixes: #35452 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Linux SZM-DESKTOP 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
What do you see instead?
/cc @ronag
The text was updated successfully, but these errors were encountered: