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

System.IO.IOException: The process cannot access the file 'xxx' because it is being used by another process during Calamari package extraction #5726

Closed
flin-8 opened this issue Jul 23, 2019 · 0 comments · Fixed by OctopusDeploy/Calamari#423

Comments

@flin-8
Copy link

commented Jul 23, 2019

The bug

During package extraction, sharpcompress first writes the file, then tries to set the file's last write times because we call it with PreserveFileTime = true.

If an anti-virus software is installed, it can often lock the extracted file when sharpcompress tries to set the file time.

What I expected to happen

Until sharpcompress handles this, we should attempt to perform some kind of retry, either by retrying the whole extract operation, or call sharpcompress with PreserveFileTime = false and restore the file timestamps ourselves in a retry loop.

Log exerpt

Error
System.IO.IOException: The process cannot access the file 'xxx' because it is being used by another process. 
May 23rd 2019 11:31:28
Error
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
May 23rd 2019 11:31:28
Error
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 
May 23rd 2019 11:31:28
Error
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) 
May 23rd 2019 11:31:28
Error
at System.IO.File.OpenFile(String path, FileAccess access, SafeFileHandle& handle) 
May 23rd 2019 11:31:28
Error
at System.IO.File.SetLastWriteTimeUtc(String path, DateTime lastWriteTimeUtc) 
May 23rd 2019 11:31:28
Error
at System.IO.FileSystemInfo.set_LastWriteTimeUtc(DateTime value) 
May 23rd 2019 11:31:28
Error
at System.IO.FileSystemInfo.set_LastWriteTime(DateTime value) 
May 23rd 2019 11:31:28
Error
(2) at SharpCompress.Common.IEntryExtensions.PreserveExtractionOptions(IEntry entry, String destinationFileName, ExtractionOptions options) 
May 23rd 2019 11:31:28
Error
(1) at SharpCompress.Archives.IArchiveEntryExtensions.WriteToDirectory(IArchiveEntry entry, String destinationDirectory, ExtractionOptions options) 
May 23rd 2019 11:31:28
Error
at Calamari.Integration.Packages.ZipPackageExtractor.Extract(String packageFile, String directory, Boolean suppressNestedScriptWarning) 
May 23rd 2019 11:31:28
Error
at Calamari.Deployment.Conventions.ExtractPackageConvention.Install(RunningDeployment deployment) 
May 23rd 2019 11:31:28
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() 
May 23rd 2019 11:31:28
Error
at Calamari.Deployment.ConventionProcessor.RunConventions()

Links

https://secure.helpscout.net/conversation/904751757/47284?folderId=2981192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.