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: make the jsonfile log friendly #1330

Merged
merged 1 commit into from
May 16, 2018
Merged

bugfix: make the jsonfile log friendly #1330

merged 1 commit into from
May 16, 2018

Conversation

fuweid
Copy link
Contributor

@fuweid fuweid commented May 16, 2018

The file related error may be os.ErrClosed. If so, we can show the
container has been stopped.

Signed-off-by: Wei Fu fhfuwei@163.com

Ⅰ. Describe what this PR did

Make the jsonfile log friendly.

Ⅱ. Does this pull request fix one issue?

Fixes #1325

Ⅲ. Describe how you did it

Since the error has been wrapped by the Write function, we should use the strings.Contain to check the error if it contains the file already closed.

Ⅳ. Describe how to verify it

Basically, it's hard to verify it without change the logic, because it causes by the concurrent issue:

Before jsonfile writes the data into the file, the container manager has been stopped it and closed it.

In order to make it happen, we can add the time.Sleep before Write. It will show up.

Ⅴ. Special notes for reviews

The file related error may be os.ErrClosed. If so, we can show the
container has been stopped.

Signed-off-by: Wei Fu <fhfuwei@163.com>
@pouchrobot pouchrobot added areas/log kind/bug This is bug report for project size/XS labels May 16, 2018
@codecov-io
Copy link

Codecov Report

Merging #1330 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1330      +/-   ##
==========================================
- Coverage   17.33%   17.32%   -0.01%     
==========================================
  Files         189      189              
  Lines       11815    11818       +3     
==========================================
  Hits         2048     2048              
- Misses       9619     9622       +3     
  Partials      148      148
Impacted Files Coverage Δ
daemon/containerio/jsonfile.go 1.42% <0%> (-0.07%) ⬇️

@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label May 16, 2018
@HusterWan HusterWan merged commit d71b477 into AliyunContainerService:master May 16, 2018
@fuweid fuweid deleted the bugfix_make_the_log_friendly branch August 3, 2018 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/log kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] unexpected log message in pouchd's log
4 participants