aws / aws-codedeploy-agent

Host Agent for AWS CodeDeploy
https://aws.amazon.com/codedeploy
Apache License 2.0
328 stars 188 forks source link

Failed deployment DownloadBundle events with error "No such file or directory - getcwd" #384

Open TomZhuPlanetart opened 9 months ago

TomZhuPlanetart commented 9 months ago

Deployment failed during Download bundle event : with unknown error "No such file or directory - getcwd"

It's not a duplicate issue of #255, the error is different.

Our production server encountered this issue today.

$ sudo lsof -p 650
COMMAND PID USER   FD      TYPE             DEVICE  SIZE/OFF      NODE NAME
ruby    650 root  cwd       DIR              259,3         6 205521082 /opt/codedeploy-agent/deployment-root/bc3648ae-4408-4e76-9ff2-66603cd21741/d-0G43URW03/deployment-archive (deleted)
ruby    650 root  rtd       DIR              259,3       257        96 /
ruby    650 root  txt       REG              259,3     68480  13134719 /usr/bin/ruby

If we check the codedeploy-agent with lsof, we can find the cwd has changed to the directory of a past deployment which has been deleted. This deployment was created 3 days ago.

Version: 1.6.0-49

Restarting the codedeploy service resolved the problem.

psavides-aws commented 6 months ago

A commit is put into 1.7 which is intended to prevent this: https://github.com/aws/aws-codedeploy-agent/commit/5a01a6d61ee52ad8c96be9aeb1fd24ffbbbee2c5

track 1.7 release here: https://github.com/aws/aws-codedeploy-agent/issues/388