You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In particular the breaking change occurred with #23186.
Before this change, code like:
compress.write(data);compress.flush(Z_PARTIAL_FLUSH,()=>{// do something with `compress.read();`});compress.write(data);compress.flush(Z_PARTIAL_FLUSH,()=>{// do something with `compress.read();`});compress.write(data);compress.flush(Z_PARTIAL_FLUSH,()=>{// do something with `compress.read();`});// etc. ...
would result in compress.read() returning only the compressed portion of data written before each flush().
After the change, node now seems to buffer the compressed contents of all of the write()s and passes that to one of the callbacks as one big chunk. This broke at least the ssh2-streams module, which depends on getting only the compressed data for particular chunks because of the need to include them in separate packets.
I’m not sure that this qualifies as a bug, but if you are sure that this is something that we should address, the easiest way would probably be to not use a global 0-sized Buffer to convey flushing information, but rather create one zero-sized Buffer per .flush() call and attach the desired flush flag to it as a property.
Activity
[-]Breaking change in v10.12.0 with zlib[/-][+]Breaking change since v10.12.0 with zlib[/+]addaleax commentedon Jul 1, 2019
I’m not sure that this qualifies as a bug, but if you are sure that this is something that we should address, the easiest way would probably be to not use a global 0-sized Buffer to convey flushing information, but rather create one zero-sized Buffer per
.flush()call and attach the desired flush flag to it as a property.zlib: do not coalesce multiple `.flush()` calls
addaleax commentedon Jul 11, 2019
@mscdex Feel free to take a look at #28520 and let me know what you think here, it should fully address this issue
zlib: do not coalesce multiple `.flush()` calls
Please ignore this msg (#1)
zlib: do not coalesce multiple `.flush()` calls
zlib: do not coalesce multiple `.flush()` calls