-
Notifications
You must be signed in to change notification settings - Fork 237
hang at Ionic.Zlib.ParallelDeflateOuputStream #74
Comments
the non-parallel write completes with no problems. may be a dupe of
edit: passing a single file seems to work, multiple files fail. (don't have many multiple file tests, will update.) |
Executing other multiple file tests, another one hung on completion of the second file, the first was added without any issues, and again in the stack traces of the hung process there are no worker threads present. |
possible cause:
The output stream is flushed successfully at the end of the load, but for some reason the extra flush on close hangs... The first flush calls EmitPendingBuffers(false,false). ... _newlyCompressedBlob is an AutoResetEvent. therefore if you call EmitPendingBuffers(true) when there are no pending buffers, then the wait at the beginning of the function will never be passed ... |
should resolve haf#74. _lastFilled is incremented when work is created _latestCompressed is set by _DeflateOne _lastWritten is set by EmitPendingBuffers All are monotonically incremented. line 883: if _lastCompressed is equal to _lastFilled then all work is complete, waiting can hang line 971: if _lastWritten==_lastCompressed, but there is still a worker thread running (ie _lastFilled>_lastCompressed) then the last chunk may not be written by the doAll flush the change on 971 may slightly change the multi-thread behavior of the proc, if flush(true) is being called from a different thread to write. But in that case the entire current implementation is flaky anyway
This still seems to be a problem. On the latest NuGet release (1.10.1), zipping a file consisting of 1024 * 128 * 9 random bytes still leads to a corrupt archive. Unzipping gives the error "bad read of entry {filename} from compressed archive.". Decompiling the NuGet package shows me that the NuGet release includes this fix... |
@AndrewBennet Thanks for reporting. Please file a new bug with a repro and/or a PR for its fix. |
@haf Actually, on better testing, it seems that this has been fixed. Sorry about that - I guess my Visual Studio was aggresively caching the original Ionic DLL. |
Hi @AndrewBennet - we believe a user is encountering this old bug you referenced. Is there some more information available about it? I am looking for guidelines for what size files should be avoided/potential workarounds without upgrading. |
As mentioned by the raiser of the issue:
So if you disable the parallelism, you should be fine. Also, it seemed to only happen for files where the size was a multiple of 64kB, so you could potentially try to avoid files of certain sizes. |
using Ionic.Zip 1.9.9.0 (and 1.9.3, i refreshed to latest library to test) the following code hangs at zip.Save()
Attaching a profiler after it has hung shows that the main thread is waiting inside save, on the stream close. I believe this is at the end of the first file, as the status bar on the app doesn't get to "zipping file 2/5", but the last row log shown is the end of the first file.
The text was updated successfully, but these errors were encountered: