Merged
Conversation
Contributor
Author
|
Here is the |
The json decoder starts to decode immediately an inotify event is received. But at the time the inotify event is trigged, the json log entry might haven't been fully written to the disk. In this case the decoder will return an "io.UnexpectedEOF" error, but there is still data remaining in the decoder's buffer. And the data should be passed to the decoder when the next inotify event is triggered. Signed-off-by: Shijiang Wei <[email protected]>
e542350 to
e41eae8
Compare
Member
|
Oh nice catch! |
Contributor
Author
|
@cpuguy83 I can 100% reproduce the error by wrapping the body of TestRunSlowStdoutConsumer or TestLogsFollowSlowStdoutConsumer in a loop and run the integration test. |
Member
|
That's really awesome! |
Member
|
LGTM |
1 similar comment
Contributor
|
LGTM |
LK4D4
added a commit
that referenced
this pull request
Oct 31, 2015
fix a race in json logger reader
Contributor
Author
Contributor
Author
|
Still failing even if I increased the if err == io.ErrUnexpectedEOF {
reader := io.MultiReader(dec.Buffered(), f)
dec = json.NewDecoder(reader)
continue
}But I'm wondering if there are chances that it falls into a dead loop 😓 To make it safer I think we can change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The json decoder starts to decode immediately a inotify event is
received.
But at the time the inotify event is trigged, the json log
entry might haven't been fully written to the disk.
In this case the decoder will return an "io.UnexpectedEOF" error, but
there is still data remaining in the decoder's buffer. And the data
should be passed to the decoder when the next inotify event is
triggered.
fixes https://jenkins.dockerproject.org/job/Windows-PRs/16236/console and https://jenkins.dockerproject.org/job/Docker-PRs/18950/console
Signed-off-by: Shijiang Wei [email protected]