Re: Review Request 56365: Windows: Refactor `WindowsLauncher` to use Job Objects.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/56365/ --- (Updated March 27, 2017, 3:45 p.m.) Review request for mesos, Alex Clemmer and Joseph Wu. Bugs: MESOS-6892 https://issues.apache.org/jira/browse/MESOS-6892 Repository: mesos Description --- This commit refactors the existing `WindowsLauncher` (copied from the `PosixLauncher`) to treat a group of processes associated with a task/container as a "Job Object" instead of a root PID and the tree containing its children. The latter is not a reasonable approach on Windows, and has been the source of subtle bugs. The Job Object approach creates a named job with a one-to-one mapping to the containerizer, and assigns the first process started for the task to the job object. After being assigned, the Windows kernel ensures all spawned child processes (specifically those made with the `CreateProcess` system call) are also assigned to the named job object. Thus this job object can then be used to query the process group's resource usage, kill the process group, and set limits on the process group. So instead of seeing a process group as a tree and referring to it by the root process's PID, the `WindowsLauncher` sees a process group as a named Job Object, the same way the Windows kernel sees it. However, the containerizer code which interacts with the launcher still refers to a task group by the singular PID, and so we have a sort of shim which maps the initial PID to the name of the job object. This is a an unfortunate consequence of the shared containerizer code being originally written for POSIX-like systems. This abstraction sets us up for implementing resource usage limits on the process group as a whole. Diffs - src/slave/containerizer/mesos/windows_launcher.hpp PRE-CREATION src/slave/containerizer/mesos/windows_launcher.cpp PRE-CREATION Diff: https://reviews.apache.org/r/56365/diff/1/ Testing --- Thanks, Andrew Schwartzmeyer
Review Request 56365: Windows: Refactor `WindowsLauncher` to use Job Objects.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/56365/ --- Review request for mesos, Alex Clemmer and Joseph Wu. Bugs: MESOS-6892 https://issues.apache.org/jira/browse/MESOS-6892 Repository: mesos Description --- This commit refactors the existing `WindowsLauncher` (copied from the `PosixLauncher`) to treat a group of processes associated with a task/container as a "Job Object" instead of a root PID and the tree containing its children. The latter is not a reasonable approach on Windows, and has been the source of subtle bugs. The Job Object approach creates a named job with a one-to-one mapping to the containerizer, and assigns the first process started for the task to the job object. After being assigned, the Windows kernel ensures all spawned child processes (specifically those made with the `CreateProcess` system call) are also assigned to the named job object. Thus this job object can then be used to query the process group's resource usage, kill the process group, and set limits on the process group. So instead of seeing a process group as a tree and referring to it by the root process's PID, the `WindowsLauncher` sees a process group as a named Job Object, the same way the Windows kernel sees it. However, the containerizer code which interacts with the launcher still refers to a task group by the singular PID, and so we have a sort of shim which maps the initial PID to the name of the job object. This is a an unfortunate consequence of the shared containerizer code being originally written for POSIX-like systems. This abstraction sets us up for implementing resource usage limits on the process group as a whole. Diffs - src/slave/containerizer/mesos/windows_launcher.hpp PRE-CREATION src/slave/containerizer/mesos/windows_launcher.cpp PRE-CREATION Diff: https://reviews.apache.org/r/56365/diff/ Testing --- Thanks, Andrew Schwartzmeyer