logfile: Check if log is closed on close error during rotate#40920
Merged
cpuguy83 merged 1 commit intomoby:masterfrom May 7, 2020
Merged
logfile: Check if log is closed on close error during rotate#40920cpuguy83 merged 1 commit intomoby:masterfrom
cpuguy83 merged 1 commit intomoby:masterfrom
Conversation
6fb2b7d to
94aa126
Compare
This prevents getting into a situation where a container log cannot make progress because we tried to rotate a file, got an error, and now the file is closed. The next time we try to write a log entry it will try and rotate again but error that the file is already closed. I wonder if there is more we can do to beef up this rotation logic. Found this issue while investigating missing logs with errors in the docker daemon logs like: ``` Failed to log message for json-file: error closing file: close <file>: file already closed ``` I'm not sure why the original rotation failed since the data was no longer available. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
94aa126 to
3989f91
Compare
tonistiigi
approved these changes
May 7, 2020
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.
This prevents getting into a situation where a container log cannot make
progress because we tried to rotate a file, got an error, and now the
file is closed. The next time we try to write a log entry it will try
and rotate again but error that the file is already closed.
I wonder if there is more we can do to beef up this rotation logic.
Found this issue while investigating missing logs with errors in the
docker daemon logs like:
I'm not sure why the original rotation failed since the data was no
longer available.