-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
pigz compiled with zlib-ng generates errors with level=1 #536
Comments
It happens due to I believe the max window size for deflate level 1 is 8192 (the size of Line 308 in bd7d222
When the call to zlib-ng/arch/x86/deflate_quick.c Line 240 in bd7d222
I think that perhaps since Removing the check for Perhaps when changing the level, if the window size changes, it should force block to flush. |
If deflate_quick can't handle safely larger window size than 8192, shouldn't we limit zlib-ng/arch/x86/deflate_quick.c Line 240 in bd7d222
... This allows changing the level back and forth without changing the code too much. |
Yes that is possible, however there is a problem in
|
I'm not completely sure adding |
I did a burn test against
Because |
Obviously when the check is there, it will consume more input than without the check, but deflate* is never supposed to consume more input than necessary to finish one block of output. When Z_FINISH is used, it doesn't wait for enough data to create full block. |
In my test case, it is needing to flush pending buf before it emits an end block. Is that expected? That means that the block is larger than Perhaps it should be:
|
Because you can call deflate() with just 1 byte input, one call doesn't have to emit at least one full block, but it shouldn't emit more than one full block because that could cause overflow of internal structures. |
I see, then if that case I don't see a problem with |
Maybe you should make a pull requests with all the modifications so it's easier for everyone to review... |
The reason I suggest calling Line 635 in bd7d222
This happens when But when Adding the check I will try to submit a PR in the coming days. |
Here are my test cases for now: nmoinvaz@fb0324b |
Not sure if this is related to issue 284 (which was also with level 1, but not a parallel compressor). I note a couple of the Pull Requests remain open . Here is a minimal adaptation of my Python scripts to illustrate the issue. This script will compile pigz using zlib-ng and validate the compression/decompression.
The crucial line is |
The changes have been merged. |
@nmoinvaz the error persists in the For c_decompress.py edit line 172 For f_speed_size_decompress.py edit line 81 When you run the modified scripts, they will generate errors:
It seems the issue persists with files created by pigz at level 1 when pigz is compiled with zlib-ng. |
I think this may still need #549 but I haven’t tested against it myself. |
@neurolabusc can you check again against latest develop branch? Thanks. |
It looks like it may still be occurring. |
@neurolabusc this should be resolved now. |
@nmoinvaz not yet fixed on the default (develop) branch of zlib-ng. I tested on an Intel i5 using MacOS and an AMD Ryzen 3900x using Ubuntu 20.04. To replicate my test:
On the other hand, the latest zlib-ng does appear to caught up with Cloudflare compression on both systems (Ryzen 3900x shown): If one runs the unedited version of c_decompress.py (which only tests level 2..9) the decompression is fine, and zlib-ng is ~20% faster than the other pigz variants and twice as fast as gzip. |
@neurolabusc can you confirm whether or not level 1 deflate_quick works when |
@nmoinvaz at least some errors are still present in the default (develop) branch of zlib-ng, even if pigz is only run in single-threaded mode. Here is how I tested this on my Linux system:
Likewise, the terminal reveals the zlib-ng variant of pigz is unable to extract the file it created:
|
Sometimes setting |
I also noticed the |
It appears with |
@nmoinvaz this passes my tests both for Neuroimaging data as well as the Silesia corpus (shown below, pigznm is your tests/def-v1 build).
|
@nmoinvaz while your branch worked on my MacOS 4-core 8-thread MacBook, I was not so lucky with my Ubuntu 20.04 Ryzen 3900X. It handles my neuroimaging corpus without issue, but reliably generates a segmentation fault when asked to compress the xray file from the silesia corpus using level 1. This can be seen in the command line outside of the script:
For my MacOS system, all values of
CloudFlare and System zlib work in all these situations. |
@neurolabusc, can you please try again with tests/def-v1. I have made some additional changes. I don't really have the ability to track down some of these segfaults that are hardware specific. |
I don't experience a crash with silesia x-ray with latest tests/def-v1 even with |
Your recent commit works on all my computers with both the Silesia corpus and my neuroimaging data. If this can be merged as a pull request, I think this will close the issue. Thanks! Below are the results for the 3900X
|
Should be fixed now in latest develop. |
…ginal because we are using switchlevels and only compressing certain parts of the original.
@reddydp discovered that pigz compiled with zlib-ng generates errors with compression level 1. This is specific to zlib-ng, as versions of pigz compiled to default, Intel or CloudFlare zlib does not show this error. Since the zlib-ng and lib-Intel use similar strategy for level-1 compression, I wonder if this is related to a fixed intel zlib issue.
We have replicated the issue on Linux as well as MacOS. To see the issue run the following commands:
The issue is only seen with pigzNG with the level 1 compression:
The text was updated successfully, but these errors were encountered: