Retry delete/copies if file is locked?

ATimsonATimson Posts: 15 Bronze 1
edited August 25, 2014 12:11PM in Deployment Manager
We're having some issues with our website deploys. We have "RedGatePurgePackageDirectoryBeforeCopy" set to true, so that the old files will be purged.

However, we're running into issues that seem to be related to file contention. We'll get errors like this:

2014-08-12 16:39:34 -04:00 ERROR Access to the path 'D:\Deploy\ClientName\Admin\Styles' is denied.

Looking out at the directory afterwards, the delete has clearly been successful, so RGDM just needed to wait a second or two.

Is there any mechanism to allow RGDM to retry if it has some sort of file access error?

Comments

  • It already does retry while purging and copying, so there might be something else going on here. Could you post the entire log for a failed deployment so I can see exactly where in the process this is going wrong?
    Development Lead
    Redgate Software
  • ATimsonATimson Posts: 15 Bronze 1
    Examples are below. (These are pulled from the raw logs from the RGDM admin, but are just the steps that are failing.)

    Example #1:
    Failed: Step 6: Admin (Deploy <ClientName>.Admin.1.0.20140812.190130)
        2014-08-12 16:39:01 -04:00 INFO   Execute step Admin (Deploy <ClientName>.Admin.1.0.20140812.190130)
        2014-08-12 16:39:35 -04:00 ERROR  Deployment on the agent failed.
    
          Failed: Execute step Admin (Deploy <ClientName>.Admin.1.0.20140812.190130) against machine BCIIS-NA1-12
          2014-08-12 16:39:01 -04:00 INFO   Evaluating deployment variables
          2014-08-12 16:39:01 -04:00 INFO   Begin deployment
          2014-08-12 16:39:01 -04:00 DEBUG  Deploying package <ClientName>.Admin 1.0.20140812.190130 to agent http://bciis-na1-12:10301/
          2014-08-12 16:39:35 -04:00 ERROR  Deployment on the Agent failed.
          2014-08-12 16:39:35 -04:00 INFO   Agent output follows:
          2014-08-12 16:39:02 -04:00 DEBUG  Begin deployment of package: <ClientName>.Admin.1.0.20140812.190130
          2014-08-12 16:39:02 -04:00 DEBUG  Deployment Agent information is below:
          2014-08-12 16:39:02 -04:00 DEBUG   - Machine name:      BCIIS-NA1-12
          2014-08-12 16:39:02 -04:00 DEBUG   - Is 64-bit OS:      False
          2014-08-12 16:39:02 -04:00 DEBUG   - Is 64-bit process: False
          2014-08-12 16:39:02 -04:00 DEBUG   - Service user name: SYSTEM
          2014-08-12 16:39:02 -04:00 DEBUG   - CLR version:       4.0.30319.1022
          2014-08-12 16:39:02 -04:00 DEBUG   - Current directory: C:\WINDOWS\system32
          2014-08-12 16:39:02 -04:00 DEBUG   - OS version:        Microsoft Windows NT 5.2.3790 Service Pack 2
          2014-08-12 16:39:02 -04:00 DEBUG   - Agent version:     2.4.10.68
          2014-08-12 16:39:02 -04:00 DEBUG  Installing package <ClientName>.Admin.1.0.20140812.190130 from uploaded package cache into D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.Admin\1.0.20140812.190130
          2014-08-12 16:39:21 -04:00 INFO   Installing '<ClientName>.Admin 1.0.20140812.190130'.
          2014-08-12 16:39:31 -04:00 INFO   Successfully installed '<ClientName>.Admin 1.0.20140812.190130'.
          2014-08-12 16:39:32 -04:00 DEBUG  The following variables are available:
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGatePackageName] = '<ClientName>.Admin'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGatePackageVersion] = '1.0.20140812.190130'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGatePackageNameAndVersion] = '<ClientName>.Admin.1.0.20140812.190130'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateEnvironmentName] = 'Prod'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateReleaseNumber] = '1.0.20140812.190130'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateReleaseNotes] = ''
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDeploymentComments] = ''
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateProjectName] = '<ClientName>'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateProjectDescription] = '<ClientName>'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateTaskId] = 'deployments-2960'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDeploymentServerVersion] = '2.4.12.1'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateReleasedBy] = 'tfsservice'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDeployedBy] = 'tfsservice'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateMachineName] = 'BCIIS-NA1-12'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGatePackageDirectoryPath] = 'D:\Deploy\<ClientName>\Admin'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGatePurgePackageDirectoryBeforeCopy] = 'True'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateNotAWebSite] = 'True'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDatabaseOptionsIgnoreSystemNamedConstraintNames] = 'True'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateCreateWebSiteApplicationPool] = '<ClientName> Admin'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDatabaseOptionsIgnoreFileGroups] = 'True'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDeploymentAgentVersion] = '2.4.10.68'
          2014-08-12 16:39:32 -04:00 DEBUG   - [RedGateDeploymentAgentMode] = 'installed-agent'
          2014-08-12 16:39:32 -04:00 INFO   Conventions will be run in the following order:
          2014-08-12 16:39:32 -04:00 INFO    - Run PreDeploy.ps1
          2014-08-12 16:39:32 -04:00 INFO    - Apply .config transforms
          2014-08-12 16:39:32 -04:00 INFO    - Update appSettings/connectionStrings in .config(s)
          2014-08-12 16:39:32 -04:00 INFO    - Copy package
          2014-08-12 16:39:32 -04:00 DEBUG   x Database package deployment plugin (not applicable to this package)
          2014-08-12 16:39:32 -04:00 INFO    - Run Deploy.ps1
          2014-08-12 16:39:32 -04:00 INFO    - Configure IIS
          2014-08-12 16:39:32 -04:00 INFO    - Delete package file
          2014-08-12 16:39:32 -04:00 INFO    - Run PostDeploy.ps1
          2014-08-12 16:39:32 -04:00 DEBUG  Looking for PowerShell scripts named PreDeploy.ps1
          2014-08-12 16:39:32 -04:00 DEBUG  No scripts called PreDeploy.ps1 were found.
          2014-08-12 16:39:32 -04:00 INFO   Looking for any configuration transformation files
          2014-08-12 16:39:32 -04:00 INFO   Looking for appSettings and connectionStrings in any .config files
          2014-08-12 16:39:32 -04:00 DEBUG  Scanning configuration file: D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.Admin\1.0.20140812.190130\Web.config
          2014-08-12 16:39:32 -04:00 INFO   Purging the directory 'D:\Deploy\<ClientName>\Admin'
          2014-08-12 16:39:34 -04:00 INFO   D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.Admin\1.0.20140812.190130\: updating cached size to 134 MB
          2014-08-12 16:39:34 -04:00 ERROR  Access to the path 'D:\Deploy\<ClientName>\Admin\Styles' is denied.
    

    Example #2:
    Failed: Step 7: <ProjectName> (Deploy <ClientName>.<ProjectName>.1.0.20140812.190130)
        2014-08-12 16:58:26 -04:00 INFO   Execute step <ProjectName> (Deploy <ClientName>.<ProjectName>.1.0.20140812.190130)
        2014-08-12 16:58:45 -04:00 ERROR  Deployment on the agent failed.
    
          Failed: Execute step <ProjectName> (Deploy <ClientName>.<ProjectName>.1.0.20140812.190130) against machine <ServerName>
          2014-08-12 16:58:27 -04:00 INFO   Evaluating deployment variables
          2014-08-12 16:58:27 -04:00 INFO   Begin deployment
          2014-08-12 16:58:27 -04:00 DEBUG  Deploying package <ClientName>.<ProjectName> 1.0.20140812.190130 to agent http://<ServerName>:10301/
          2014-08-12 16:58:45 -04:00 ERROR  Deployment on the Agent failed.
          2014-08-12 16:58:45 -04:00 INFO   Agent output follows:
          2014-08-12 16:58:27 -04:00 DEBUG  Begin deployment of package: <ClientName>.<ProjectName>.1.0.20140812.190130
          2014-08-12 16:58:27 -04:00 DEBUG  Deployment Agent information is below:
          2014-08-12 16:58:27 -04:00 DEBUG   - Machine name:      <ServerName>
          2014-08-12 16:58:27 -04:00 DEBUG   - Is 64-bit OS:      False
          2014-08-12 16:58:27 -04:00 DEBUG   - Is 64-bit proc<ProjectName>: False
          2014-08-12 16:58:27 -04:00 DEBUG   - Service user name: SYSTEM
          2014-08-12 16:58:27 -04:00 DEBUG   - CLR version:       4.0.30319.1022
          2014-08-12 16:58:27 -04:00 DEBUG   - Current directory: C:\WINDOWS\system32
          2014-08-12 16:58:27 -04:00 DEBUG   - OS version:        Microsoft Windows NT 5.2.3790 Service Pack 2
          2014-08-12 16:58:27 -04:00 DEBUG   - Agent version:     2.4.10.68
          2014-08-12 16:58:27 -04:00 DEBUG  Installing package <ClientName>.<ProjectName>.1.0.20140812.190130 from uploaded package cache into D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.<ProjectName>\1.0.20140812.190130
          2014-08-12 16:58:37 -04:00 INFO   Installing '<ClientName>.<ProjectName> 1.0.20140812.190130'.
          2014-08-12 16:58:42 -04:00 INFO   Succ<ProjectName>fully installed '<ClientName>.<ProjectName> 1.0.20140812.190130'.
          2014-08-12 16:58:42 -04:00 DEBUG  The following variables are available:
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGatePackageName] = '<ClientName>.<ProjectName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGatePackageVersion] = '1.0.20140812.190130'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGatePackageNameAndVersion] = '<ClientName>.<ProjectName>.1.0.20140812.190130'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateEnvironmentName] = 'Prod'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateReleaseNumber] = '1.0.20140812.190130'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateReleaseNotes] = ''
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDeploymentComments] = ''
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateProjectName] = '<ClientName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateProjectDescription] = '<ClientName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateTaskId] = 'deployments-2963'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDeploymentServerVersion] = '2.4.12.1'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateReleasedBy] = 'tfsservice'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDeployedBy] = 'tfsservice'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateMachineName] = '<ServerName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGatePackageDirectoryPath] = 'D:\Deploy\<ClientName>\<ProjectName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGatePurgePackageDirectoryBeforeCopy] = 'True'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateNotAWebSite] = 'True'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDatabaseOptionsIgnoreSystemNamedConstraintNames] = 'True'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateCreateWebSiteApplicationPool] = '<ClientName> <ProjectName>'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDatabaseOptionsIgnoreFileGroups] = 'True'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDeploymentAgentVersion] = '2.4.10.68'
          2014-08-12 16:58:42 -04:00 DEBUG   - [RedGateDeploymentAgentMode] = 'installed-agent'
          2014-08-12 16:58:42 -04:00 INFO   Conventions will be run in the following order:
          2014-08-12 16:58:42 -04:00 INFO    - Run PreDeploy.ps1
          2014-08-12 16:58:42 -04:00 INFO    - Apply .config transforms
          2014-08-12 16:58:42 -04:00 INFO    - Update appSettings/connectionStrings in .config(s)
          2014-08-12 16:58:42 -04:00 INFO    - Copy package
          2014-08-12 16:58:42 -04:00 DEBUG   x Database package deployment plugin (not applicable to this package)
          2014-08-12 16:58:42 -04:00 INFO    - Run Deploy.ps1
          2014-08-12 16:58:42 -04:00 INFO    - Configure IIS
          2014-08-12 16:58:42 -04:00 INFO    - Delete package file
          2014-08-12 16:58:42 -04:00 INFO    - Run PostDeploy.ps1
          2014-08-12 16:58:42 -04:00 DEBUG  Looking for PowerShell scripts named PreDeploy.ps1
          2014-08-12 16:58:42 -04:00 DEBUG  No scripts called PreDeploy.ps1 were found.
          2014-08-12 16:58:42 -04:00 INFO   Looking for any configuration transformation files
          2014-08-12 16:58:42 -04:00 INFO   Looking for appSettings and connectionStrings in any .config files
          2014-08-12 16:58:42 -04:00 DEBUG  Scanning configuration file: D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.<ProjectName>\1.0.20140812.190130\Web.config
          2014-08-12 16:58:43 -04:00 INFO   Purging the directory 'D:\Deploy\<ClientName>\<ProjectName>'
          2014-08-12 16:58:43 -04:00 INFO   D:\Red Gate\DeploymentAgent\Applications\Prod\<ClientName>.<ProjectName>\1.0.20140812.190130\: updating cached size to 153 MB
          2014-08-12 16:58:43 -04:00 ERROR  Unable to copy the package to the specified directory 'D:\Deploy\<ClientName>\<ProjectName>'. One or more files in the directory may be locked by another process. You could use a PreDeploy.ps1 script to stop any processes that may be locking the file. Error details follow.
          2014-08-12 16:58:43 -04:00 ERROR  Caused by:
          2014-08-12 16:58:43 -04:00 ERROR  -The directory is not empty.
    
Sign In or Register to comment.