File Locked DeploymentJournal.xml

I’ve seen an issue whereby occasionaly when a deployment is held due to another process on the machine.
After being released the DeploymentJournal.xml is locked and causes the subsequent deploy to fail.
Please find the log below (i have removed package and version):

Another deployment-related activity is in progress on this machine (Deploying package [REDACTED-PACKAGE], version [REDACTED-VERSION]); the request has been added to a queue.
Info 09:49:31
The machine is ready; continuing…
Info 09:49:31
Beginning deployment…
Fatal 09:49:31
The process cannot access the file ‘E:\Octopus\Applications.Tentacle\DeploymentJournal.xml’ because it is being used by another process.
System.IO.IOException: The process cannot access the file ‘E:\Octopus\Applications.Tentacle\DeploymentJournal.xml’ because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
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)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Octopus.Platform.Util.OctopusPhysicalFileSystem.OpenFile(String path, FileMode mode, FileAccess access, FileShare share) in y:\work\refs\heads\master\source\Octopus.Platform\Util\OctopusPhysicalFileSystem.cs:line 166
at Octopus.Platform.Util.OctopusPhysicalFileSystem.OpenFile(String path, FileAccess access, FileShare share) in y:\work\refs\heads\master\source\Octopus.Platform\Util\OctopusPhysicalFileSystem.cs:line 161
at Octopus.Tentacle.Deployment.Journal.DeploymentJournalReaderWriter.d__0.MoveNext() in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournalReaderWriter.cs:line 31
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Buffer1…ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Octopus.Tentacle.Deployment.Journal.DeploymentJournal.GetInstalledPaths() in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournal.cs:line 184
at Octopus.Tentacle.Deployment.Packages.PackageInstaller.GenerateUniqueInstallationDirectoryByAppendingACounter(String packageInstallationPath, PackageMetadata package) in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Packages\PackageInstaller.cs:line 108
at Octopus.Tentacle.Deployment.Packages.PackageInstaller.InstallPackageUsingNuGet(StoredPackage package, String packageInstallationPath, Boolean suppressNestedScriptWarnings, ILog log) in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Packages\PackageInstaller.cs:line 81
at Octopus.Tentacle.Deployment.Packages.PackageInstaller.Install(StoredPackage package, PackageInstallationOptions options, ILog activityLog) in y:\work\refs\heads\master\source\Octopus.Tentacle\Deployment\Packages\PackageInstaller.cs:line 59
at Octopus.Tentacle.Orchestration.Deploy.Package.TentaclePackageDeployment.Receive(AcquiredEvent message) in y:\work\refs\heads\master\source\Octopus.Tentacle\Orchestration\Deploy\Package\TentaclePackageDeployment.cs:line 231
at Pipefish.Actor.OnReceivingTyped[TBody](Message message) in y:\work\3cbe05672d69a231\source\Pipefish\Actor.cs:line 113
Tentacle version 2.5.5.318

The above formatting is better awful.

I’ve screenshot the error to try and help.

Hi Chris,

Thanks for letting us know. Is there a virus scanner or anything else running that might try to open the file?

After a deployment, we create a new temporary file, then delete the old deploymentjournal.xml file and then rename the new one. It could be that something else on the system locks the journal during this time.

Paul