You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/04/24 17:29:00 UTC
[jira] [Commented] (YARN-11690) Update container executor to use CGROUP2_SUPER_MAGIC in cgroup 2 scenarios
[ https://issues.apache.org/jira/browse/YARN-11690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17840526#comment-17840526 ]
ASF GitHub Bot commented on YARN-11690:
---------------------------------------
brumi1024 opened a new pull request, #6771:
URL: https://github.com/apache/hadoop/pull/6771
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g., 'HADOOP-17799. Your PR title ...'.
-->
### Description of PR
The container executor function write_pid_to_cgroup_as_root writes the PID of the newly launched container to the correct cgroup.procs file. However it checks if the file is mounted on a cgroup filesystem, and does that check using the magic number, which differs for v1 and v2. This should handle v1 or v2 filesystems as well.
### For code changes:
- [ ] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files?
> Update container executor to use CGROUP2_SUPER_MAGIC in cgroup 2 scenarios
> --------------------------------------------------------------------------
>
> Key: YARN-11690
> URL: https://issues.apache.org/jira/browse/YARN-11690
> Project: Hadoop YARN
> Issue Type: Sub-task
> Components: container-executor
> Reporter: Benjamin Teke
> Assignee: Benjamin Teke
> Priority: Major
>
> The container executor function {{write_pid_to_cgroup_as_root}} writes the PID of the newly launched container to the correct cgroup.procs file. However it checks if the file is mounted on a cgroup filesystem, and does that check using the magic number, which differs for v1 and v2. This should handle v1 or v2 filesystems as well.
> {code:java}
> /**
> * Write the pid of the current process to the cgroup file.
> * cgroup_file: Path to cgroup file where pid needs to be written to.
> */
> static int write_pid_to_cgroup_as_root(const char* cgroup_file, pid_t pid) {
> int rc = 0;
> uid_t user = geteuid();
> gid_t group = getegid();
> if (change_effective_user(0, 0) != 0) {
> rc = -1;
> goto cleanup;
> }
> // statfs
> struct statfs buf;
> if (statfs(cgroup_file, &buf) == -1) {
> fprintf(LOGFILE, "Can't statfs file %s as node manager - %s\n", cgroup_file,
> strerror(errno));
> rc = -1;
> goto cleanup;
> } else if (buf.f_type != CGROUP_SUPER_MAGIC) {
> fprintf(LOGFILE, "Pid file %s is not located on cgroup filesystem\n", cgroup_file);
> rc = -1;
> goto cleanup;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org