aws / aws/aws-codedeploy-agent
file already exists deployment failure and duplicate log entries
- Dominant language
- Rust
- Stars
- 337
- Forks
- 195
- Avg merge
- 10h 54m
- Merged PRs (30d)
- 4
Description
We have been successfully deploying our application to numerous Windows 2019 servers for some time now until this past weekend. A round of operating system updates were applied and it appears that SSM upgrade CodeDeploy at the same time. We attempted a deployment immediately after and it failed.
The error happens after the zip file is downloaded and during the extraction process. The error is:
```
Exception calling "ExtractToDirectory" with "2" argument(s): "The file
'C:\ProgramData\Amazon\CodeDeploy\ce282efb-0b60-4d7f-8e29-233d4ce2710a\d-PMKMQMU3I\deployment-archive\appspec.yml'
already exists."
```
I've seen numerous articles on rectifying this, but none seem to apply to our situation. What is odd is that every line in the CodeDeploy log file seems to be duplicated after the upgrade, almost as if there are two instances of it running. Here is a sample from the time the service is started:
```
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy Instance Agent Service: started
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy Instance Agent Service: started
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: On Premises config file does not exist or not readable
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: On Premises config file does not exist or not readable
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Configuring deploy control client: Region="us-east-1"
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Configuring deploy control client: Region="us-east-1"
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Deploy control endpoint override=
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Deploy control endpoint override=
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Enable auth policy = false
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Enable auth policy = false
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Archives to retain is: 5}
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Archives to retain is: 5}
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Initializing Host Agent: Host Identifier = arn:aws:ec2:us-east-1:zzz:instance/zzz
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Initializing Host Agent: Host Identifier = arn:aws:ec2:us-east-1:z:instance/zzz
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Validating CodeDeploy Plugin Configuration
2022-06-12T06:09:36 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Validating CodeDeploy Plugin Configuration
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:36 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:37 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:37 INFO [codedeploy-agent(1972)]: CodeDeploy endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:37 DEBUG [codedeploy-agent(1972)]: Current deploy control endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:37 DEBUG [codedeploy-agent(1972)]: Current deploy control endpoint: https://codedeploy-commands.us-east-1.amazonaws.com
2022-06-12T06:09:41 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: CodeDeploy Plugin Configuration is valid
2022-06-12T06:09:41 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: CodeDeploy Plugin Configuration is valid
2022-06-12T06:09:41 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PollHostCommand:
2022-06-12T06:09:41 DEBUG [codedeploy-agent(1972)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PollHostCommand:
2022-06-12T06:09:41 INFO [codedeploy-agent(1972)]: Version file found in C:/ProgramData/Amazon/CodeDeploy/.version with agent version OFFICIAL_1.3.2.1902_msi.
2022-06-12T06:09:41 INFO [codedeploy-agent(1972)]: Version file found in C:/ProgramData/Amazon/CodeDeploy/.version with agent version OFFICIAL_1.3.2.1902_msi.
```
After the initial error, a rollback is triggered that also fails. The AWS console reports the same error for both the initial deployment and the rollback:
```
Error Code: Unknown
Message: No such file or directory @ rb_sysopen - C:\ProgramData/Amazon/CodeDeploy/ce282efb-0b60-4d7f-8e29-233d4ce2710a/d-OFHJUGT3I/deployment-archive/web\App_WebReferences\
```
Once it is all said and done, I checked the deployment folder and the zip file seems to have been extracted cleanly - the appsec file is there and the App_WebReferences.
Any help would be greatly appreciated, and please let me know if there is any other information I can provide to help remedy this.
Thanks
Contributor guide
Assessment
This issue has not been assessed yet.