Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Conversation

@Random-Liu
Copy link
Member

Add simple ExecSync based on current containerd api.

Some TODOs in the future which will be addressed in future PRs:

  1. Switch to containerd client and add unit test.
  2. Add ExecSync timeout support, including timeout waiting and graceful termination after timeout.

Signed-off-by: Lantao Liu [email protected]

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

See comments

@@ -73,6 +74,11 @@ type ContainerMetadata struct {
// into the store directly.
// TODO(random-liu): Reset this field to false during state recoverry.
Copy link
Member

Choose a reason for hiding this comment

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

/s/recoverry/recovery/

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// TODO(random-liu): Remove following fields after switching to new containerd
// client.
// Not including them in unit test now because they will be removed soon.
// Spec is the oci runtime spec used to run the container.
Copy link
Member

Choose a reason for hiding this comment

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

fields, them, they.. but only Spec is there...was this supposed to cover more fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Initially there are more. Will change to field.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

if err != nil {
return nil, fmt.Errorf("an error occurred when try to find container %q: %v", r.GetContainerId(), err)
}
id := r.GetContainerId()
Copy link
Member

Choose a reason for hiding this comment

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

move this assignment up and use id as param to .Get()

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, will do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to id := meta.ID.

The metadata store may support truncated index soon, so get the id from metadata.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

}
exitCode, err := waitContainerExec(cancel, events, id, resp.Pid, r.GetTimeout())
if err != nil {
return nil, fmt.Errorf("failed to wait for exec in container %q to finish: %v", id, err)
Copy link
Member

Choose a reason for hiding this comment

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

this return eats the unknownExitCode.. What's that for if we are going to nil it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! We do have some special logic here in dockershim. Let me check.

Copy link
Member Author

Choose a reason for hiding this comment

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

If containerd dies during waiting, the exec process may still be running, so I think we should return error instead of 255 exit code without error.

I still keep the unknownExitCode, because:

  1. We may still need it when adding the recovery logic after daemon restart.
  2. Just in case we use the 0 exit code by mistake.

Copy link
Member

Choose a reason for hiding this comment

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

ok.. will watch for the recovery logic code to see unknownExitCode in action then :-)

Signed-off-by: Lantao Liu <[email protected]>
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM

@mikebrow mikebrow added the lgtm label Jun 16, 2017
@Random-Liu Random-Liu merged commit 1f3a73d into containerd:master Jun 16, 2017
@Random-Liu Random-Liu deleted the add-exec-sync branch June 16, 2017 23:58
lanchongyizu pushed a commit to lanchongyizu/cri-containerd that referenced this pull request Sep 3, 2017
kevpar added a commit to kevpar/cri that referenced this pull request Sep 1, 2020
Re-implement "No HTTP2" support using "GODEBUG=http2client=0"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants