Commit 9f452741 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

cgroup: after killing cgroup processes, ensure the group is really dead gone. wait for 3s at max

parent 2db9ecac
...@@ -321,16 +321,17 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re ...@@ -321,16 +321,17 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
assert(controller); assert(controller);
/* This safely kills all processes; first it sends a SIGTERM, /* This safely kills all processes; first it sends a SIGTERM,
* then checks 8 times after 50ms whether the group is * then checks 8 times after 200ms whether the group is now
* now empty, and finally kills everything that is left with * empty, then kills everything that is left with SIGKILL and
* SIGKILL */ * finally checks 5 times after 200ms each whether the group
* is finally empty. */
for (i = 0; i < 10; i++) { for (i = 0; i < 15; i++) {
int sig, r; int sig, r;
if (i <= 0) if (i <= 0)
sig = SIGTERM; sig = SIGTERM;
else if (i >= 9) else if (i == 9)
sig = SIGKILL; sig = SIGKILL;
else else
sig = 0; sig = 0;
...@@ -338,7 +339,7 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re ...@@ -338,7 +339,7 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
if ((r = cg_kill_recursive(controller, path, sig, true, rem, NULL)) <= 0) if ((r = cg_kill_recursive(controller, path, sig, true, rem, NULL)) <= 0)
return r; return r;
usleep(50 * USEC_PER_MSEC); usleep(200 * USEC_PER_MSEC);
} }
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment