Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up old daemon cgroups #1595

Merged
merged 2 commits into from
Jul 30, 2019
Merged

Clean up old daemon cgroups #1595

merged 2 commits into from
Jul 30, 2019

Conversation

pgombar
Copy link
Contributor

@pgombar pgombar commented Jul 29, 2019

Description

Daemons from version 2.2.31 to 2.2.40 added their PID to a now-obsolete cgroup WALinuxAgent/WALinuxAgent. Add logic to move that PID to the new cgroup, walinuxagent.service for each controller to ensure we track both the daemon and extension handler process.


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and Travis.CI is passing.

Quality of Code and Contribution Guidelines


This change is Reviewable

azurelinuxagent/common/cgroupapi.py Outdated Show resolved Hide resolved
@@ -69,6 +69,7 @@ def run(self, child_args=None):
self.initialize_environment()

CGroupConfigurator.get_instance().create_agent_cgroups(track_cgroups=False)
CGroupConfigurator.get_instance().cleanup_old_cgroups()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the cleanup is just temporary we should move the logic to create_agent_cgroups instead of calling a separate function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favour of keeping it separate to maintain one responsibility per function and to make the testing easier. The removal logic stays the same wherever the call happens.


contents = fileutil.read_file(os.path.join(old_path, "cgroup.procs"))

if daemon_pid in contents:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it to make sure that we're only writing the daemon PID if it's not already there (by explicitly checking it's still in the old cgroup).

azurelinuxagent/common/cgroupapi.py Show resolved Hide resolved
@pgombar pgombar merged commit bbc2ff4 into Azure:develop Jul 30, 2019
@pgombar pgombar deleted the fix_old_daemon branch July 30, 2019 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants