aws / aws-codedeploy-agent

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

bugfix: pid should gt 0 #229

Closed ottocho closed 4 years ago

ottocho commented 5 years ago

Issue #228 , if available:

Description of changes:

When the pid file is empty, find_pid returns 0 because ruby parses empty to zero.

Check if pid is great then 0 before using process_running? to check the process. Put the pid-checking outside function find_pid because: empty pid file is actually a polluted state, so the pid file should be reset by clean_stale_pid.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 91.679% when pulling fc10edbea4db25333337bb2b9b4d3ec0836e1ff1 on ottocho:master into 7a58ba993f7b92a4012d12ee4573d50bd19a812d on aws:master.

mbad0la commented 4 years ago

@ottocho , has this been reviewed by anyone from AWS yet? I'm suspecting that the service start command suffers from something similar as well, where the agent describes the status as active (exited) and I have to explicitly restart the service to get the status as active (running).

Platform : Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-1057-aws x86_64) Instance Type : t2.nano System Information (with a running agent) :

System information as of Sun Mar 15 05:42:45 UTC 2020

  System load:  0.0               Processes:           94
  Usage of /:   23.4% of 7.69GB   Users logged in:     0
  Memory usage: 56%               IP address for eth0: xxx.xx.xx.xxx
  Swap usage:   0%
ottocho commented 4 years ago

@mbad0la Hi! no, it's not reviewed yet.

My issue was: because of disk full the pid file was empty, and thus pid was parsed as 0. Remove the empty file fixed.

brndnblck commented 4 years ago

Thanks for the contribution! There will be a resolution to this issue in our upcoming release.

ottocho commented 4 years ago

This issue is resolved by Release v1.2.1 https://github.com/aws/aws-codedeploy-agent/pull/271