-
Notifications
You must be signed in to change notification settings - Fork 30k
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
tar-stream regression in 13 with pipeline #32954
Comments
cc @ronag |
I'm unsure how to fix this. We are kind of stuck choosing between:
The only thing I can think of right now is to fix |
This comment has been minimized.
This comment has been minimized.
@ronag not sure i follow what you mean by making it a duplex? It's a writable stream that forwards parts of that stream as a series of streaming files as it parses them. the forced auto destroy in pipeline makes the sub-stream forward the stream destruction to the main input stream. |
The tricky thing for tar-stream with this forced behaivor is that the substream (the one emitted in entry) doesn't know when it's done being piped, so when pipeline forces the destroy on it, it doesn't know if that destroy is because: a) a user wants to destroy the main stream |
Instead of emitting |
@mafintosh: I do see the problem but unless it's implemented as a
|
I don't see how changing it will help. Any module that forwards a substream will have this problem, like HTTP did. Even if we did change it, this has +5mio weekly downloads, so massive breakage. I'm open for ideas, but I think we're borked |
Would you mind if I try to make a PR against
I'm not sure what to do here. If we break the |
I think the best option is to restore the old behavior. |
@ronag go for it I don't think this case is possible to fix though extract.on('error', function (err) {
// err === that error from below
})
extract.on('entry', function (header, stream) {
pipeline(stream, new Writable({
write (data, enc, cb) {
cb(null)
},
final (cb) {
this.destroy(new Error('I am crashing now'))
}
)
}) |
I'm ok with that. |
I'm +1 on restoring old behaviour also. I think autoDestroy is a better mechanic for this for modules. Also means we can drop the HTTP special casing. |
Just as a note, the old behavior was to sometimes destroy. |
This comment has been minimized.
This comment has been minimized.
I'll try to test that commit |
This PR logically reverts nodejs#31940 which has caused lots of unnecessary breakage in the ecosystem. This PR also aligns better with the actual documented behavior: `stream.pipeline()` will call `stream.destroy(err)` on all streams except: * `Readable` streams which have emitted `'end'` or `'close'`. * `Writable` streams which have emitted `'finish'` or `'close'`. The behavior introduced in nodejs#31940 was much more aggressive in terms of destroying streams. This was good for avoiding potential resources leaks however breaks some common assumputions in legacy streams. Furthermore, it makes the code simpler and removes some hacks. Fixes: nodejs#32954 Fixes: nodejs#32955
This PR logically reverts nodejs#31940 which has caused lots of unnecessary breakage in the ecosystem. This PR also aligns better with the actual documented behavior: `stream.pipeline()` will call `stream.destroy(err)` on all streams except: * `Readable` streams which have emitted `'end'` or `'close'`. * `Writable` streams which have emitted `'finish'` or `'close'`. The behavior introduced in nodejs#31940 was much more aggressive in terms of destroying streams. This was good for avoiding potential resources leaks however breaks some common assumputions in legacy streams. Furthermore, it makes the code simpler and removes some hacks. Fixes: nodejs#32954 Fixes: nodejs#32955 PR-URL: nodejs#32968 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Mathias Buus <[email protected]> Backport-PR-URL: nodejs#32980
This PR logically reverts #31940 which has caused lots of unnecessary breakage in the ecosystem. This PR also aligns better with the actual documented behavior: `stream.pipeline()` will call `stream.destroy(err)` on all streams except: * `Readable` streams which have emitted `'end'` or `'close'`. * `Writable` streams which have emitted `'finish'` or `'close'`. The behavior introduced in #31940 was much more aggressive in terms of destroying streams. This was good for avoiding potential resources leaks however breaks some common assumputions in legacy streams. Furthermore, it makes the code simpler and removes some hacks. Fixes: #32954 Fixes: #32955 PR-URL: #32968 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Mathias Buus <[email protected]>
This PR logically reverts #31940 which has caused lots of unnecessary breakage in the ecosystem. This PR also aligns better with the actual documented behavior: `stream.pipeline()` will call `stream.destroy(err)` on all streams except: * `Readable` streams which have emitted `'end'` or `'close'`. * `Writable` streams which have emitted `'finish'` or `'close'`. The behavior introduced in #31940 was much more aggressive in terms of destroying streams. This was good for avoiding potential resources leaks however breaks some common assumputions in legacy streams. Furthermore, it makes the code simpler and removes some hacks. Fixes: #32954 Fixes: #32955 PR-URL: #32968 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Mathias Buus <[email protected]>
What steps will reproduce the bug?
stream.pipeline no longer compatible with tar-stream (around 500k GitHub dependents) for tar files with more than one file.
Attached is a test case.
This seems to be related to changes that force autoDestroy behaviour on existing streams when using pipeline, added in #31940
Seems to be the same regression fixed for HTTP in #32197
The text was updated successfully, but these errors were encountered: