]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
cgroup: Move builder process out of cgroup before destroying it.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 10 Mar 2013 00:22:37 +0000 (01:22 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 10 Mar 2013 00:22:37 +0000 (01:22 +0100)
Before all processes in the cgroup are killed, the builder process
is migrated to the parent group, because kill_and_wait() waits
for nothing because it will never kill its own process.

python/pakfire/builder.py

index 7427a8cc7d8794eda457090d8b0424db060e7cad..944c1a03d980b5361b2e3a4597c1d9326e3473eb 100644 (file)
@@ -200,11 +200,13 @@ class BuildEnviron(object):
 
        def stop(self):
                if self.cgroup:
+                       # Move the builder process out of the cgroup.
+                       self.cgroup.migrate_task(self.cgroup.parent, os.getpid())
+
                        # Kill all still running processes in the cgroup.
                        self.cgroup.kill_and_wait()
 
                        # Remove cgroup and all parent cgroups if they are empty.
-                       self.cgroup.migrate_task(self.cgroup.root, os.getpid())
                        self.cgroup.destroy()
 
                        parent = self.cgroup.parent