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

bugfix: attach hanging of cri container #2130

Merged
merged 1 commit into from
Aug 22, 2018

Conversation

YaoZengzeng
Copy link
Contributor

@YaoZengzeng YaoZengzeng commented Aug 21, 2018

Signed-off-by: YaoZengzeng yaozengzeng@zju.edu.cn

Ⅰ. Describe what this PR did

If we want to get the log of cri container, the step as follows:

  1. create container

  2. attach to the io of the container

  3. start the container

Then the IO of the container will be created in step 2

So we should decide whether open the Stdin of Container IO, otherwise it will never be opened

which will result the hanging of attach

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Aug 21, 2018
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
@codecov-io
Copy link

Codecov Report

Merging #2130 into master will decrease coverage by 0.04%.
The diff coverage is 72.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2130      +/-   ##
==========================================
- Coverage   64.88%   64.84%   -0.05%     
==========================================
  Files         208      208              
  Lines       16458    16465       +7     
==========================================
- Hits        10679    10676       -3     
- Misses       4451     4459       +8     
- Partials     1328     1330       +2
Flag Coverage Δ
#criv1alpha1test 33.04% <55.55%> (-0.12%) ⬇️
#criv1alpha2test 33.8% <16.66%> (-0.02%) ⬇️
#integrationtest 39.5% <0%> (-0.06%) ⬇️
#unittest 23.93% <0%> (-0.02%) ⬇️
Impacted Files Coverage Δ
cri/v1alpha2/cri.go 64.63% <100%> (ø) ⬆️
cri/v1alpha2/cri_utils.go 82.36% <100%> (+0.02%) ⬆️
cri/v1alpha1/cri.go 63.35% <50%> (-0.79%) ⬇️
cri/v1alpha1/cri_utils.go 83.33% <69.23%> (-0.32%) ⬇️
apis/server/utils.go 61.9% <0%> (-4.77%) ⬇️
ctrd/image.go 76.75% <0%> (-2.2%) ⬇️
daemon/mgr/container.go 56.04% <0%> (ø) ⬆️
ctrd/watch.go 80.3% <0%> (+4.54%) ⬆️

Stdin: openStdin,
Stdout: true,
Stderr: true,
CriLogFile: f,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just double check this fd will be closed when finished, right? @YaoZengzeng

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be closed when IO is finished.

Copy link
Contributor

Choose a reason for hiding this comment

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

could we disable json-file here? I mean that we can disable json-file in other PR.

Stdin: openStdin,
Stdout: true,
Stderr: true,
CriLogFile: f,
Copy link
Contributor

Choose a reason for hiding this comment

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

could we disable json-file here? I mean that we can disable json-file in other PR.

}
err = c.ContainerMgr.Attach(context.Background(), containerID, attachConfig)
if err != nil {
return fmt.Errorf("failed to attach to container %q to get its log: %v", containerID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

how about pkgerrors.Wrapf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we could change all this stuff of CRI in another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

cool

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid fuweid merged commit 9e49369 into AliyunContainerService:master Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants