8000 doc: stage1-implementors-guide.md: clarify pid vs ppid by alban · Pull Request #2397 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

doc: stage1-implementors-guide.md: clarify pid vs ppid #2397

Merged
merged 1 commit into from
Apr 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Documentation/devel/stage1-implementors-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ An alternative stage 1 could forego systemd-nspawn and systemd altogether, or re
All that is required is an executable at the place indicated by the `coreos.com/rkt/stage1/run` entrypoint that knows how to apply the pod manifest and prepared ACI file-systems to good effect.

The resolved entrypoint must inform rkt of its PID for the benefit of `rkt enter`.
Stage 1 must write the host PIDs of the pod's process #1 and that process's parent to these two files, respectively:
Stage 1 implementors have two options for doing so; only one must be implemented:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only? Or maybe "at least". But i'm not sure if it's true - in kvm flavor i was writing into ppid file, and this led to hang in endless loop, in entering process.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was waiting for a child process of lkvm. But that child process does not exist.

I think that "only" is better. If both "pid" and "ppid" exist, which one is stage0 supposed to use?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without "pid" entering process hangs. So this "only" still leads to mistake.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was #2389, fixed by #2396. But still, only one of the two files are written by stage1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clarify in the code here that the ordering is not important and only one of them must be supplied (currently the code reads as if it is favouring "pid", but if you factor in the raciness of the function then we can consider that ordering to be arbitrary).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either fix that in this PR or file a follow up and land this as-is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated.


* `/var/lib/rkt/pods/run/$uuid/pid`: the PID of the process that is PID 1 in the container.
* `/var/lib/rkt/pods/run/$uuid/ppid`: the PID of the parent of the process that is PID 1 in the container.
* `/var/lib/rkt/pods/run/$uuid/pid`: the PID of the process that will be given to the "enter" entrypoint.
* `/var/lib/rkt/pods/run/$uuid/ppid`: the PID of the parent of the process that will be given to the "enter" entrypoint. That parent process must have exactly one child process.

#### Arguments

Expand Down
5 changes: 3 additions & 2 deletions rkt/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,8 +909,9 @@ func (p *pod) getPID() (int, error) {

// getContainerPID1 returns the pid of the process with pid 1 in the pod.
func (p *pod) getContainerPID1() (pid int, err error) {
// rkt supports two methods to find the container's PID 1:
// the pid file and the ppid file.
// rkt supports two methods to find the container's PID 1: the pid
// file and the ppid file.
// The ordering is not important and only one of them must be supplied.
// See Documentation/devel/stage1-implementors-guide.md
for {
var ppid int
Expand Down
0