A customer of mine receives this error (yes, I know it is an older CK library):
write ChilkatLog: WriteZipAndClose: DllDate: Mar 1 2011 UnlockPrefix: XXX Username: SYSTEM Architecture: Little Endian; 32-bit Language: Visual C++ 6.0 Using temp directory where target Zip is located. tempFile: \larnacaSunlight_File_shareliveArchiveOutboundckz_Z46S.tmp Encryption: 0 PasswordProtected: 0 CentralDirOffset: 142717 NumCentralDirRecords: 1957 EndOfDirectoryOffset: 279707 closeHandle: windowsHandle: 348 zipFilename: \larnacaSunlight_File_shareliveArchiveOutboundHMEI20121224.zip MoveTempToDestZip1: WindowsError: The process cannot access the file because it is being used by another process. WindowsErrorCode: 0x20 MoveTempToDestZip2: WindowsError: The process cannot access the file because it is being used by another process. WindowsErrorCode: 0x20 from_filename: \larnacaSunlight_File_shareliveArchiveOutboundckz_Z46S.tmp to_filename: \larnacaSunlight_File_shareliveArchiveOutboundHMEI20121224.zip Failed to move Zip file Failed.
I am 99% sure it is caused by a virus scanner keeping a lock on the temporary zipfile so the rename to zip fails.
Is there a way I can "inject" a pause (for example 5 seconds) before CkZip tries to rename the tmp file, perhaps using CkZipProgress? That would give the scanner time to free the tmp file.
Alternatively, can you implement retry logic in CkZip for those access-denied (actually ERROR_SHARING_VIOLATION) problems? Or can I just call WriteZipAndClose again myself?
PS, I don't think this customer is allowed to exclude directories from the virus-scanner settings.
I always recommend testing with the latest version to see if a problem still exists. This would be a good idea in this case.
You cannot "inject" a pause, but your app can certainly wait and re-try the WriteZipAndClose method.
answered Jan 14 '13 at 08:34
I will ask him to try the latest version that uses the current CK library.
But in that case I imagine the tmp file is recreated by CkZip? Then it won't help because the virus-scanner will again lock the tmp file so it again can not be moved/renamed by CkZip. It would really be nice if you can implement retry logic for those sharing violation cases.
answered Jan 15 '13 at 03:22