You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by "DevinLeamy (via GitHub)" <gi...@apache.org> on 2024/04/24 14:30:35 UTC
[PR] [cgroups2] Made `cgroups2::processes` optionally recursive. [mesos]
DevinLeamy opened a new pull request, #570:
URL: https://github.com/apache/mesos/pull/570
Previously, `cgroups2::processes` could only fetch processes from inside of the provided cgroup. We can now fetch all of the processes inside of a cgroup subtree by passing an (optional) `recursive` flag.
```c++
Try<std::set<pid_t>> processes(
const std::string& cgroup,
bool recursive = false);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@mesos.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [cgroups2] Made `cgroups2::processes` optionally recursive. [mesos]
Posted by "bmahler (via GitHub)" <gi...@apache.org>.
bmahler closed pull request #570: [cgroups2] Made `cgroups2::processes` optionally recursive.
URL: https://github.com/apache/mesos/pull/570
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@mesos.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [cgroups2] Made `cgroups2::processes` optionally recursive. [mesos]
Posted by "bmahler (via GitHub)" <gi...@apache.org>.
bmahler commented on code in PR #570:
URL: https://github.com/apache/mesos/pull/570#discussion_r1578248075
##########
src/linux/cgroups2.cpp:
##########
@@ -487,6 +487,27 @@ Try<set<pid_t>> processes(const string& cgroup)
pids.insert(*pid);
}
+ if (!recursive) {
+ return pids;
+ }
+
+ Try<set<string>> cgroups = cgroups2::get(cgroup);
+ foreach (const string& cgroup, *cgroups) {
+ Try<set<pid_t>> _pids = cgroups2::processes(cgroup);
+ if (_pids.isError() && cgroups2::exists(cgroup)) {
+ return Error(
+ "Failed to get processes in '" + cgroup + "': " + _pids.error());
+ } else if (_pids.isError()) {
+ // The cgroup was just removed. Ignore the error and treat it as if
+ // the cgroup had no processes.
+ continue;
Review Comment:
this is going to ignore parse failures as well since you're looking at any error from the processes call, would be better to check this on read
##########
src/linux/cgroups2.cpp:
##########
@@ -487,6 +487,27 @@ Try<set<pid_t>> processes(const string& cgroup)
pids.insert(*pid);
}
+ if (!recursive) {
+ return pids;
+ }
+
+ Try<set<string>> cgroups = cgroups2::get(cgroup);
+ foreach (const string& cgroup, *cgroups) {
Review Comment:
this can crash, naked de-reference without handling the error case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@mesos.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org