Repository navigation
stream: regression in v14, this.push(null) in Transform doesn't emit end #35926
Description
Activity
- addedstreamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
on Nov 2, 2020 @nodejs/streams @ronag
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Nov 2, 2020 Confirmed, this is a bug, just tested in the latest v14 and on master.
In this case... shouldn't it actually fail with
ERR_STREAM_WRITE_AFTER_ENDsincepipewill continue writing?If find this case quite problematic.
In this case... shouldn't it actually fail with
ERR_STREAM_WRITE_AFTER_ENDsincepipewill continue writing?Problem is data not processed in consumer at all. Handlers, which have to call end/destroy are not reached. Looks like data buffered somewhere until stream end.
https://github.com/nodeca/probe-image-size/blob/master/stream.js - full source if anyone interested.
The same with generator-based source:
async function * generate() { for (;;) { yield Buffer.alloc(20000); } } let src = Readable.from(generate());
In this case... shouldn't it actually fail with ERR_STREAM_WRITE_AFTER_END since pipe will continue writing?
No.
.pipe()historically automatically unpiped from the source if the destination ended, i.e. the source is not paused while it should be.I think we'd need to bisect this if you do not have a suspect.
I think we'd need to bisect this if you do not have a suspect.
Haven't started digging yet. Trying to understand how it should work first.
No. .pipe() historically automatically unpiped from the source if the destination ended, i.e. the source is not paused while it should be.
I'm not sure i entirely agree with this.
.pipe()will unpipe on'end', however'end'is emitted sometime after the destination has been.end():ed so there is still a possibility (which is quite probable) that pipe will call.write()after.end()but before'end'.I suspect we would need to update
.pipe()to check forwritableEndedbefore.write()to correctly achieve the behavior you are assuming.let's get the fix in and then do a follow-up refactor.
- added a commit that references this issue
on Nov 4, 2020 - added a commit that references this issue
on Nov 4, 2020 - added a commit that references this issue
on Nov 22, 2020 - added a commit that references this issue
on Dec 4, 2020 - added 4 commits that reference this issue
on Dec 9, 2020
endevent is emitted bydst, transform stops, source pauses.endevent does not get emitted bydst, transform runs indefinitely.