Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: do not require pid while created #895

Closed
wants to merge 1 commit into from

Conversation

darstahl
Copy link
Contributor

It seems odd to me that the pid is REQUIRED when the status is created, as at that time, the container process is not running. How would one know the pid for a process that is not yet running (or created, as the lifecycle only requires that create creates the namespace, and prohibits it from creating the process)?

If this is not the case, then the language for container process should be clarified.

Signed-off-by: Darren Stahl darst@microsoft.com

@wking
Copy link
Contributor

wking commented Jul 12, 2017 via email

@wking
Copy link
Contributor

wking commented Jul 12, 2017 via email

@darstahl
Copy link
Contributor Author

Yes, this was a Windows motivated PR, but without the context of the separation of create and start, it seemed odd that a PID would exist before the process. There is no runtime supplied container process on Windows. The user-specified program in Windows containers (both Hyper-V and Windows Server) must be a new process created at the time of start as a Windows containers do not have a analogy to execvpe(3).

I can't comment on if going behind the back of the Windows runtime will be supported or not, but that would be done using the container id rather than pid.

@wking
Copy link
Contributor

wking commented Jul 12, 2017 via email

@vbatts
Copy link
Member

vbatts commented Jul 12, 2017

LGTM

Approved with PullApprove

@vbatts
Copy link
Member

vbatts commented Jul 12, 2017

Oh i forgot the update needed to be platform specifc.

@darstahl
Copy link
Contributor Author

What would be the suggested way to have a field that is not required in the created state on Windows, but is still required in the running state?

Would it be better to just exclude this field on Windows instead as suggested above?

@crosbymichael
Copy link
Member

Maybe:

(int, REQUIRED when statusiscreated under linux, OPTIONAL on other platforms) is the ID of the container process, as seen by the host.

@wking
Copy link
Contributor

wking commented Jul 12, 2017

Maybe:

(int, REQUIRED when status is created under linux, OPTIONAL on other platforms) is the ID of the container process, as seen by the host.

Our current pattern is to use either “Linux” (e.g. here) or “linux” (e.g. here). I'd rather not use a lowercase “linux” without backticks. Otherwise that wording looks good to me.

@crosbymichael
Copy link
Member

@wking fine with me. @darrenstahlmsft please make this change ASAP for 1.0

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jul 12, 2017
Through FIXME (whatever commit merges both opencontainers#895 and opencontainers#896).

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jul 12, 2017
Through FIXME (whatever commit merges both opencontainers#895 and opencontainers#896).

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor

wking commented Jul 12, 2017

Other changes we probably want to make (from here):

Signed-off-by: Darren Stahl <darst@microsoft.com>
@darstahl
Copy link
Contributor Author

Updated and added changes suggested by @wking

@darstahl
Copy link
Contributor Author

@crosbymichael I'm fine if you want to take the carry over this one.

@@ -9,7 +9,7 @@ type State struct {
// Status is the runtime status of the container.
Status string `json:"status"`
// Pid is the process ID for the container process.
Pid int `json:"pid"`
Pid *int `json:"pid"`
Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative would be to leave off the pointer and use omitempty, since zero isn't a valid PID. Which way we should go depends on the unresolved #772, but the maintainers may have a one-off opinion on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative would be to leave off the pointer and use omitempty

#897 is currently going this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I talked to @crosbymichael offline. He's going to carry this. I'll close this PR in favour of #897

@darstahl
Copy link
Contributor Author

Closing in favour of #897

@darstahl darstahl closed this Jul 12, 2017
@darstahl darstahl deleted the PidCreated branch July 12, 2017 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants