From: Andrew Morton <akpm@linux-foundation.org>
To: Chris Mason <clm@fb.com>, Michal Hocko <mhocko@suse.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: bugzilla-daemon@bugzilla.kernel.org,
bugzilla.kernel.org@plan9.de, linux-btrfs@vger.kernel.org,
linux-mm@kvack.org, Jan Kara <jack@suse.cz>
Subject: Re: [Bug 199931] New: systemd/rtorrent file data corruption when using echo 3 >/proc/sys/vm/drop_caches
Date: Tue, 5 Jun 2018 13:03:29 -0700 [thread overview]
Message-ID: <20180605130329.f7069e01c5faacc08a10996c@linux-foundation.org> (raw)
In-Reply-To: <bug-199931-27@https.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Tue, 05 Jun 2018 18:01:36 +0000 bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=199931
>
> Bug ID: 199931
> Summary: systemd/rtorrent file data corruption when using echo
> 3 >/proc/sys/vm/drop_caches
A long tale of woe here. Chris, do you think the pagecache corruption
is a general thing, or is it possible that btrfs is contributing?
Also, that 4.4 oom-killer regression sounds very serious.
> Product: Memory Management
> Version: 2.5
> Kernel Version: 4.14.33
> Hardware: All
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> Assignee: akpm@linux-foundation.org
> Reporter: bugzilla.kernel.org@plan9.de
> Regression: No
>
> We found that
>
> echo 3 >/proc/sys/vm/drop_caches
>
> causes file data corruption. We found this because we saw systemd journal
> corruption (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897266) and
> tracked this to a cron job dropping caches every hour. The filesystem in use is
> btrfs, but I don't know if it only happens with this filesystem. btrfs scrub
> reports no problems, so this is not filesystem metdata corruption.
>
> Basically:
>
> # journalctl --verify
> [everything fine at this point]
> # echo 3 >/proc/sys/vm/drop_caches
> # journalctl --verify
> [journalctl now reporting corruption problems]
>
> This is not always reproducible, but when deleting our journal, creating log
> messages for a few hours and then doing the above manually has a ~50% chance of
> corrupting the journal.
>
> After investigating we found that rtorrent also suffers from corrupted
> downloads when using the above echo - basically, downloading torrents is fine,
> except when executing the above echo a few times during a download, after which
> rtorrent very likely reports a failed hash check.
>
> All of this is reproducible on two different boxes, so is unlikely to be a
> hardware issue.
>
> On one affected server we have over 50TB of files, many that have been created
> with the cronjob in place, and none of them are corrupted (we have md5sums of
> everything), so it seems to be related to something that systemd and rtorrent
> do, rather than a generic file corruption issue.
>
> I also was able to "cmp -l" two corrupted files with their correct version, and
> the corruption manifests itself as streaks of ~100-3000 zero bytes instead of
> the real data. The start offset sems random, but the end offset seems to be
> always aligned to a 4K offset - speculating without the hindrance of knowledge
> this feels like a race somewhere between writing to a mmapped area and freeing
> it, or so.
>
> Here is the output of cmp -l between a working and a corrupted file, for two
> files:
>
> http://data.plan9.de/01.cmp.txt
> http://data.plan9.de/02.cmp.txt
>
> We also have a mysql database with hundreds of gigabytes of writes per day on
> one server which also does not seem to suffer from any corruption.
>
> As for why we would do something silly as dropping the caches every hour (in a
> cronjob), we started doing this recently because after kernel 4.4, we got
> frequent OOM kills despite having gigabytes of available memory (e.g. 12GB in
> use, 20GB page cache and 16GB empty swap and bang, mysql gets killed). We found
> that that the debian 4.9 kernel is unusable, and 4.14 works, *iff* we use the
> above as an hourly cron job, so we did that, and afterwards run into
> rtorrent/journald corruption issues. Without the echo in place, mysql usually
> gets oom-killed after a few days of uptime.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
next parent reply other threads:[~2018-06-05 20:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-199931-27@https.bugzilla.kernel.org/>
2018-06-05 20:03 ` Andrew Morton [this message]
2018-06-05 21:22 ` [Bug 199931] New: systemd/rtorrent file data corruption when using echo 3 >/proc/sys/vm/drop_caches Tetsuo Handa
2018-06-05 21:38 ` Andrew Morton
2018-06-05 21:52 ` james harvey
2018-06-06 19:06 ` Marc Lehmann
2018-06-06 20:33 ` james harvey
2018-06-08 7:18 ` Duncan
2018-06-06 0:18 ` Chris Mason
2018-06-06 13:38 ` Liu Bo
2018-06-06 13:44 ` Chris Mason
2018-06-06 13:55 ` Liu Bo
2018-06-06 8:45 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180605130329.f7069e01c5faacc08a10996c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=bugzilla.kernel.org@plan9.de \
--cc=clm@fb.com \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).