Parallel Deflate issue in DotNetZip Library

For deployment packages we use DotNetZip Library to create zip files. One of the files recently became corrupted when put in the package.

7zip error

CRC error in 7zip

We investigated the changing of Compression Level and Compression Method. Which solved the issue but none were acceptable. See details in table below.

After finding more discussion on the issue (ZipFile.AddFile fails depending of the file size) We noted the file size was 1048576, which is 128 * 8 * 1024 and fits the problem with the parallel deflate compression method. The solution is to not use parallelism.

zip.ParallelDeflateThreshold = -1;

This dropped the performance to 41 sec, but that was acceptable.

Deflate level 0 Deflate (issue) No parallel BZip2
3 sec 19 sec 41 sec 71 sec
292 Mb 110 Mb 110 Mb 96 Mb

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.