Skip to content

Add running wait condition to container and exec#36147

Closed
mlaventure wants to merge 2 commits intomoby:masterfrom
mlaventure:wait-container-running
Closed

Add running wait condition to container and exec#36147
mlaventure wants to merge 2 commits intomoby:masterfrom
mlaventure:wait-container-running

Conversation

@mlaventure
Copy link
Contributor

- What I did

  • Added a "Running" condition to the container wait endoint
  • Added an exec wait endpoint

- How I did it

  • emacs

- How to verify it

- Description for the changelog

Add running condition as an option to contanier wait endpoint
Add exec wait endpoint to wait on exec running or exit state

- A picture of a cute animal (not mandatory but encouraged)

Fixes #35407

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
@cpuguy83
Copy link
Member

cpuguy83 commented Feb 5, 2018

17:23:25 Congratulations!  All commits are properly signed with the DCO!
17:25:53 api/types/exec/exec_wait.go:20:6:warning: type name will be used as exec.ExecWaitOKBody by other packages, and that stutters; consider calling this WaitOKBody (golint)
17:25:53 api/types/exec/exec_wait.go:12:6:warning: type name will be used as exec.ExecWaitOKBodyError by other packages, and that stutters; consider calling this WaitOKBodyError (golint)
17:25:53 daemon/exec/exec.go:57:6:warning: type name will be used as exec.ExecStatus by other packages, and that stutters; consider calling this Status (golint)

@cpuguy83
Copy link
Member

cpuguy83 commented Feb 5, 2018

This design looks good, and I was just thinking we needed a wait condition for running.

@mlaventure
Copy link
Contributor Author

The lint in the api are generated swagger files, can't find where to tell the linter to ignore it.

@mlaventure mlaventure force-pushed the wait-container-running branch from 599880f to 184e478 Compare February 7, 2018 19:37
@dnephin
Copy link
Member

dnephin commented Feb 7, 2018

hack/validate/gometalinter.json, the Exclude list, there's a similar exclude there already

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
@mlaventure mlaventure force-pushed the wait-container-running branch from 184e478 to 36da0ce Compare February 7, 2018 20:19
@mlaventure
Copy link
Contributor Author

thanks @dnephin!

updated.

@thaJeztah
Copy link
Member

Discussing this in the maintainers meeting, and we'd prefer the fix for the issue to be implemented without introducing a new API endpoint (that's a new feature, so should be looked at separately).

We could fix the issue by making the "resize" endpoint wait for the exec to be started, and then perform the actual resize (as a separate PR so that we can keep the discussion on the "wait" endpoint separate)

@mlaventure
Copy link
Contributor Author

mlaventure commented Feb 8, 2018 via email

@mlaventure
Copy link
Contributor Author

Looking at the possible Resize solution instead, I realize that neither my current 2 PRs or a potential change would really fix the issue.

I had forgotten, but contrary to the initial process, runc does not separate the "create" from the "start" part. Meaning, it's all really due to scheduling timing in the exec case whether or not the signal is sent after the final exec process has been created.

Maybe if we modify containerd-shim to send an event when runc has written the pid, it could work. But that's just an idea out of my hat. Would need to investigate a bit more.

@cpuguy83
Copy link
Member

cpuguy83 commented Feb 9, 2018

I think it would be fair to block resize while the exec is in a "starting" (this would be new) state.... alternatively it could send back a typed error to know if the client should retry... The former requires no client changes.

The exec start endpoint is hijacking the connection way before it's needed and as such sending a response back too soon. We could minimize this... probably would need to anyway to set a starting state before the http handler responds.

post:
summary: "Wait for a container"
description: "Block until a container stops, then returns the exit code."
description: "Block until a container reach a given condition, then returns the exit code."
Copy link

Choose a reason for hiding this comment

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

reach -> reaches?

@thaJeztah
Copy link
Member

ping @tonistiigi @cpuguy83 PTAL

@thaJeztah
Copy link
Member

Discussing in the maintainers meeting with @cpuguy83 and while this may not be the solution for the exec resize issue, having a wait for exec in general is a useful thing to have, so I'm moving this to code review

simon-ohara added a commit to simon-ohara/coast-base that referenced this pull request May 27, 2018
…earing wonky on start due to container resize issue. resizing the terminal window fixes the issue (workaround). waiting for fix to moby/moby#36147
@thaJeztah
Copy link
Member

@mlaventure @tonistiigi guess we can close this one, now that #37172 was merged?

@mlaventure
Copy link
Contributor Author

Yep, closing

@mlaventure mlaventure closed this Jun 11, 2018
@mlaventure mlaventure deleted the wait-container-running branch June 11, 2018 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants