Uh oh!
There was an error while loading. Please reload this page.
[v13.x] zlib: emits 'close' event after readable 'end' - #32215
Closed
MylesBorins wants to merge 1 commit into
Closed
[v13.x] zlib: emits 'close' event after readable 'end'#32215MylesBorins wants to merge 1 commit into
MylesBorins wants to merge 1 commit into
Conversation
Call the close method after readable 'end' so that 'close' will be emitted afterwards. Fixes: nodejs#32023 PR-URL: nodejs#32050 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
nodejs-github-bot
commented
Mar 11, 2020
Collaborator
MylesBorins
commented
Mar 11, 2020
ContributorAuthor
Member
Seems to fail with the following: ['createDeflate','createInflate',true],['createDeflateRaw','createInflateRaw',true],['createBrotliCompress','createBrotliDecompress',true]Maybe related to the "extra data after the compressed data"? |
ronag
commented
Mar 11, 2020
Member
I think I managed to reduce it to minimal repro: 'use strict';require('../common');constzlib=require('zlib');functioncreateWriter(target,buffer){constwriter={size: 0};constwrite=()=>{target.write(Buffer.from([buffer[writer.size++]]),()=>{if(writer.size<buffer.length){target.flush(write);}else{target.end();}});};write();returnwriter;}constcompData=Buffer.from('789c4a04000000ffff4a02000000ffff4a06000000ffff4a01000000ffff4a05000000ffff4a03000000ffff4a07000000ffffca00000000ffffca04000000ffffca02000000ffffca06000000ffffca01000000ffffca05000000ffffca03000000ffffca07000000ffff2a00000000ffff2a04000000ffff2a02000000ffff2a06000000ffff2a01000000ffff2a05000000ffff2a03000000ffff2a07000000ffffaa00000000ffffaa04000000ffffaa02000000ffff4a04000000ffff4a02000000ffff4a06000000ffff4a01000000ffff4a05000000ffff4a03000000ffff4a07000000ffffca00000000ffffca04000000ffffca02000000ffffca06000000ffffca01000000ffffca05000000ffffca03000000ffffca07000000ffff2a00000000ffff2a04000000ffff2a02000000ffff2a06000000ffff2a01000000ffff2a05000000ffff2a03000000ffff2a07000000ffffaa00000000ffffaa04000000ffffab02004250163f','hex')constcompDataExtra=Buffer.concat([compData,Buffer.from('extra')]);constdecomp=zlib.createInflate();decomp.resume();createWriter(decomp,compDataExtra); |
Member
@MylesBorins if 0e89b64 is also included this does not seem to fail. |
MylesBorins
commented
Mar 11, 2020
ContributorAuthor
ronag
commented
Mar 11, 2020
Member
Yea sorry, my mistake. Re-applying it basically reverts this commit. |
4 tasks
Member
#32216 seems to resolve it on 13.x. I'm unsure why this doesn't fail on master. |
ronag
reviewed
Mar 11, 2020
| this._finishFlushFlag = finishFlush; | ||
| this._defaultFullFlushFlag = fullFlush; | ||
| this.once('end', _close.bind(null, this)); | ||
| this.once('end', this.close); |
Member
There was a problem hiding this comment.
Instead of doing this, just remove the event listener and enable autoDestroy: true. Which will ensure the stream is not prematurely destroyed.
ronag
commented
Mar 14, 2020
Member
@MylesBorins: I would recommend closing this in favor of #32220 and backporting that once it lands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Call the close method after readable 'end' so that 'close' will be
emitted afterwards.
Fixes: #32023
PR-URL: #32050
Reviewed-By: Anna Henningsen anna@addaleax.net
Reviewed-By: Luigi Pinca luigipinca@gmail.com