Bug 1534827

Summary: docker journald log driver keeps file descriptors to deleted /var/log/journal/*/*.journal files
Product: Red Hat Enterprise Linux 7 Reporter: Takayoshi Kimura <tkimura>
Component: dockerAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: 42wimdroid, amurdaca, dornelas, fshaikh, jamills, jkaur, jtudelag, kwalker, lsm5, pportant, rhowe, rkharwar, rmeggins, sakulkar, santiago, schoudha, stwalter
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: docker-1.13.1-52.gitce62987.el7_4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-07 09:51:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1186913, 1513780    

Description Takayoshi Kimura 2018-01-16 02:53:44 UTC
Description of problem:

Disk is getting full because docker journald log driver keeps file descriptors to deleted /var/log/journal/*/*.journal files.

The following command shows a lot of deleted file descriptors.

# find /proc/*/fd -ls | grep  '(deleted)'

854653876    0 lr-x------   1 root     root           64 Jan 15 19:52 /proc/8004/fd/6793 -> /var/log/journal/aab77f0af404433695f49265761415c7/system\ (deleted)
854653877    0 lr-x------   1 root     root           64 Jan 15 19:52 /proc/8004/fd/6794 -> /var/log/journal/aab77f0af404433695f49265761415c7/system\ (deleted)
854653879    0 lr-x------   1 root     root           64 Jan 15 19:52 /proc/8004/fd/6796 -> /var/log/journal/aab77f0af404433695f49265761415c7/system\ (deleted)

Version-Release number of selected component (if applicable):

docker-1.12.6-55
docker-1.12.6-68

How reproducible:

Always when running a lot of containers

Steps to Reproduce:
1.
2.
3.

Actual results:

Disk full due to deleted journal files

Expected results:

Journal files deleted and free disk space

Additional info:

Upstream issue: https://github.com/moby/moby/issues/27343

Comment 2 Takayoshi Kimura 2018-01-16 03:47:31 UTC
To workaround, truncate the deleted files manually in a cron job:

# cd /proc/`pidof dockerd-current`/fd
# ls -l |grep var.log.journal |grep deleted.$ |awk '{print $9}' |while read x; do :> $x; done;

Comment 3 Peter Portante 2018-01-18 00:46:05 UTC
Is it docker code that is doing this? Or is this really the systemd journal API interfaces doing this? The reason to ask is because we seem the same behavior with rsyslog configured to use imjournal.

Comment 6 Nalin Dahyabhai 2018-01-18 21:48:02 UTC
It looks like the journal reading logic in dockerd isn't handling SD_JOURNAL_INVALIDATE status results from sd_journal_process(), which would be a good time for it to close and reopen the handle that it's using to follow the journal as entries get added to it.  A patch to handle that shouldn't be very large.

Comment 8 Peter Portante 2018-01-19 01:22:36 UTC
It looks like rsyslog already handles this, see https://github.com/rsyslog/rsyslog/blob/v8-stable/plugins/imjournal/imjournal.c#L505

Comment 17 errata-xmlrpc 2018-03-07 09:51:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0436

Comment 21 42wimdroid 2019-10-20 17:11:04 UTC
This issue still exists in docker-1.13.1-103.git7f2769b

I'm using the truncate deleted files workaround, at the moment, but upstream now has recently fixed this in https://github.com/moby/moby/pull/38859

Can this be backported?