Issue with MaxOutputSegmentSize

Aug 23, 2011 at 8:07 AM
Edited Aug 23, 2011 at 11:27 AM

Hello,

whenever i am using MaxOutputSegmentSize i get an Exception (System.UnauthorizedAccessException: Access denied ...).

I use the current v 1.9.1.8

Ist an basic code adding a file and two folders to the archive, i reproduced the exception with different folders (Size about 400MB to 1GB with lots of smaller files).

When i do not use MaxOutputSegmentSize it works, when i give MaxOutputSegmentSize an Value for 100MB the exception will allways occur when the second file (.z02) reached its max size, a third file is not created then. When i set the MaxOutputSegmentSize to a value for 5MB there are several files and the Exception will occur later, i.e. on the end of file .z08.

The directories used are local directories with all read/write rights für IUSR / IIS_IUSR / IIS_WPG but those rights did not change anything.

The strange thing is that the first z01 file always works, the exception allways occurs on a later one.

If i use zip.ZipErrorAction = ZipErrorAction.Skip or .Retry i get an System.ObjectDisposedException instead.

Can anyone help me with this?

 

ZipFile zip = new ZipFile(backupPath + "Backup.zip");
zip
.MaxOutputSegmentSize = maxSize;
//zip.TempFileFolder = @"D:\Backup\Temp"; //seems not to make any difference

zip
.Comment = "Backup created at " + System.DateTime.Now.ToString("G");
zip
.AddFile(dbBackup.FullName,"Database");
zip
.AddDirectory(physicalAppPath,"Application");
zip
.AddDirectory(mailArchivePath,"MailArchive");
zip
.Save(); //Exception occurs here


The Stack Trace:

bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
bei
System.IO.File.Move(String sourceFileName, String destFileName)
bei
Ionic.Zip.ZipSegmentedStream.TruncateBackward(UInt32 diskNumber, Int64 offset)
bei
Ionic.Zip.ZipEntry.Write(Stream s)
bei
Ionic.Zip.ZipFile.Save()

bei MyProject.Configuration.Backup.BackupLogic.Backup(Boolean monthly) in D:\projects\MyProject.Configuration\Backup\BackupLogic.cs:Zeile 100. bei MyProject.Configuration.Backup.BackupLogic.ScheduledBackup() in D:\projects\MyProject.Configuration\Backup\BackupLogic.cs:Zeile 42. bei MyProject.Configuration.BackupTimer.CreateThread(Object parameters) in D:\projects\MyProject.Configuration\BackupTimer.cs:Zeile 60. bei System.Threading.ExecutionContext.runTryCode(Object userData) bei System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart(Object obj)



Exception and StackTrace for using ZipErrorAction.Skip:

ObjectDisposed Exception was unhandled:  Could not access an closed file

bei
System.IO.FileStream.get_Position()
bei
Ionic.Zip.ZipEntry.Write(Stream s)
bei
Ionic.Zip.ZipFile.Save()
...




 


Aug 24, 2011 at 1:40 PM

The Problem was that there are gzip files (.gz with password) in one Folder - it seems that DotNetZip can not split those (7zip can).

So as soon as it reaches the end of a .zip file filled with those gzip files the exception occurs.

I used now a workaround so i cycle all my files, calc the total size and create single (not splitted) zip files each time i reach my max size - the Problem (Bug?) for DotNetZip remains.

Coordinator
Aug 24, 2011 at 4:27 PM

Hmmm, this is unfortunate.  It does seem like there's still bug in the segmented archive stuff. I'll need a way to reproduce it . I went through lots of testing trying to make sure that the segmented stuff works well.  I don't see errors.  If you could package up a small testcase that reliably reproduces the problem, I'll get to work on it.