1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/logger/loggerutils
= b102d4637c Fix windows log file rotation with readers
This fixes the case where log rotation fails on Windows while there are
clients reading container logs.

Evicts readers if there is an error during rotation and try rotation again.
This is needed for Windows with this scenario:

1. `docker logs -f` is called
2. Log rotation occurs (log.txt -> log.txt.1, truncate and re-open
   log.txt)
3. Log rotation occurs again (rm log.txt.1, log.txt -> log.txt.1)

On step 3, before this change, the log rotation will fail with `Access
is denied`.
In this case, what we have is a reader holding a file handle to the
primary log file. The log file is then rotated, but the reader still has
a the handle open. `FILE_SHARE_DELETE` allows this to happen... but then
we try to do it again for the next rotation and it blows up.
So when it blows up we force all the readers to disconnect, close the
log file, and try rotation again, which will succeed based on the added
tests.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-10-29 18:38:30 +00:00
..
cache Support configuration of log cacher. 2020-02-19 17:02:34 -05:00
file_unix.go Fix logfile to open all files with custom openFile 2020-10-28 20:36:32 +00:00
file_windows.go Fix windows log file rotation with readers 2020-10-29 18:38:30 +00:00
file_windows_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
log_tag.go Add canonical import comment 2018-02-05 16:51:57 -05:00
log_tag_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
logfile.go Fix windows log file rotation with readers 2020-10-29 18:38:30 +00:00
logfile_test.go Fix windows log file rotation with readers 2020-10-29 18:38:30 +00:00