Skip to content
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

Zip task hangs with latest Ionic.Zip.Reduced #2

Open
mkarpuk opened this issue May 25, 2012 · 17 comments
Open

Zip task hangs with latest Ionic.Zip.Reduced #2

mkarpuk opened this issue May 25, 2012 · 17 comments

Comments

@mkarpuk
Copy link

mkarpuk commented May 25, 2012

Recently I have updated MSBuild.Community.Tasks library to the last version in my build process and found out that Zip task which compressed deployment package hangs (it displays that all files were added and stay in that state at least for 2 hrs). It worked if I run zip separately from build process, however.

I wasn't managed to figure out the problem, but using old version of Ionic.Zip (v1.9.1.5 instead of Ionic.Zip.Reduced v 1.9.1.8) solved the issue.

@pwelter34
Copy link
Member

Not able to reproduce this error.

@danjagnow
Copy link

I downloaded the library today specifically for the Zip task, and I'm also experiencing that it hangs when it gets to the Zip step. It created a file named DotNetZip-mcgziv5n.tmp which quickly went to 6,189 KB and then... at least 10 minutes of nothing. I had to cancel the build, and repeating the process later produced the same result.

@blackboy69
Copy link

This needs to be reopened! I am having the same issue! zip hangs in TFS Build, but works fine in a separate process! This leaves a file named "DotNetZip-lk2cvgvz.tmp" that doesn't grow

@mkarpuk
Copy link
Author

mkarpuk commented Aug 21, 2012

Hi, folks! If you could send a project on which you were able to reproduce the issue, I believe it will help a lot to figure out a problem. Unfortunately I can't publish sources where task hangs (they are proprietary), I tried to reproduce on a small test project, but with no success. I could just confirm, that problem occurred only if Zip task called at the end of build process (if sources are compiled as one step and MSBuild called once again with just Zip task, it works). This could be one more workaround. It does not connected with TFS Build, since we are using Hudson, and the same behavior was observed on my local machine from pure commandline call of MSBuild

@pwelter34 pwelter34 reopened this Aug 27, 2012
@michael-baker
Copy link

The problem appears to be a deadlock inside Ionic.Zlib.ParallelDeflateOutputStream.EmitPendingBuffers. A thread will get stuck on _newlyCompressedBlob.WaitOne() forever which is why the process hangs.

@derkyjadex
Copy link
Contributor

I'm also having this problem with a particular file. As far as I can tell, there seems to be a race condition. Sometimes the ZIP file will be created, but it will be corrupt, other times it just hangs. There seems to be a bug for this already, http://dotnetzip.codeplex.com/workitem/14252. Changing ZipLevel doesn't do anything for me.

I do have a small test project that reproduces the issue, but it uses an assembly that I can't really give out. I will try to break it down further and send it out if I get a chance. In the meantime, I've added a ParallelCompression property to the Zip task to work around this issue. I can't push the patch from where I am now, but will do tomorrow morning.

@derkyjadex
Copy link
Contributor

Ok, I've added a pull request for my work around, no idea how to attach it to this issue.

pwelter34 added a commit that referenced this issue Jan 18, 2013
@ctigeek
Copy link

ctigeek commented Jan 27, 2013

I had the same issue, and this change worked. One thing I had to figure out, that isn't obvious from the discussion above, is that you have to add the parameter ParallelCompression="false" to the zip task for the fix to take effect.

dblock added a commit to dblock/msiext that referenced this issue Nov 14, 2013
@dblock
Copy link

dblock commented Nov 14, 2013

confirm workaround that @ctigeek suggested, worked for me too

@musicmen
Copy link

workaround did solve the problem for me too, thx!

@ghost
Copy link

ghost commented Jan 22, 2015

We're not getting the task/build hanging, but in our case it repeatedly produced a corrupt zip file (on 1.4.0.88); always with the same file corrupt inside the zip. Disabling ParallelCompression (thanks @ctigeek !) also worked around this problem.

Our specific issue seems almost certainly related to https://dotnetzip.codeplex.com/workitem/14087 (file is an exact multiple of 64kB which breaks parallel deflate) but highlights that perhaps parallel compression should be disabled by default in msbuildtasks; especially as Ionic seems unmaintained now and this bug is pretty dangerous for build automation primarily used to produce deployable artifacts and very hard to pin down.

Alternative 1, perhaps given it is apparently unmaintained with serious defects it's time to abandon Ionic?
Alternative 2, since Ionic is built and distributed internally inside the tasks, perhaps the suggested patch fix on the linked issue could be applied and rebuilt here? (not ideal...)

@NuKiNuKe
Copy link

NuKiNuKe commented May 7, 2015

The ParallelCompression workaround did solve the problem for me! Thank you!

@AndrewBennet
Copy link
Contributor

I've created a fork where I've replaced the DotNetZip with a better maintained fork. In particular, it fixes the issue with ParallelDeflateOutputStream, and allows use of ParallelCompression without fear of creating a corrupt archive.

@haf
Copy link

haf commented Oct 27, 2016

Just saying hi. Followed notifications a bit too eagerly =). Feel free to PR to that fork and it'll be merged.

@AndrewBennet
Copy link
Contributor

Hi :)
I was referring to a pull request to this project (msbuildtasks), where I replaced the original DotNetZip, with your fork. (The pull request is currently open.)
Thanks!

@AndrewBennet
Copy link
Contributor

I think this issue is resolved with the recent merged pull request. Would it be possible to update the nuget package? (I don't know what the standard release cycle is for this repository). Thanks a lot!

@pwelter34
Copy link
Member

I'll push today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests