From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-rrd] cache: skip non-utf8 lines in rrd journal
Date: Mon, 24 Jun 2024 16:24:15 +0200 [thread overview]
Message-ID: <20240624142415.41470-1-c.ebner@proxmox.com> (raw)
In certain situations garbage might be written to the rrd journal,
e.g. by a hard crash of the host.
Therefore, skip not only non-parsable lines, as is already the case,
but also skip over lines containing non-utf8 contents.
Reported in the community forum:
https://forum.proxmox.com/threads/149542/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Tested by writing garbage to the `rrd.journal` located at
`/var/lib/proxmox-backup/rrdb` via `dd`.
Not only does this lead to the summary graphs in the WebUI not being
updated anymore, but also the systemd journal is being spammed with
apply old journal messages after a reboot, potentially filling up the
available disk space.
proxmox-rrd/src/cache.rs | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/proxmox-rrd/src/cache.rs b/proxmox-rrd/src/cache.rs
index 5b123a6b..96c92fd8 100644
--- a/proxmox-rrd/src/cache.rs
+++ b/proxmox-rrd/src/cache.rs
@@ -280,11 +280,21 @@ fn apply_journal_lines(
loop {
linenr += 1;
let mut line = String::new();
- let len = if lock_read_line {
+ let result = if lock_read_line {
let _lock = state.read().unwrap(); // make sure we read entire lines
- reader.read_line(&mut line)?
+ reader.read_line(&mut line)
} else {
- reader.read_line(&mut line)?
+ reader.read_line(&mut line)
+ };
+
+ let len = match result {
+ Ok(len) => len,
+ Err(err) => {
+ log::warn!(
+ "unable to parse rrd journal '{journal_name}' line {linenr} (skip) - {err}",
+ );
+ continue;
+ }
};
if len == 0 {
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next reply other threads:[~2024-06-24 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 14:24 Christian Ebner [this message]
2024-06-24 15:53 ` Dietmar Maurer
2024-06-24 17:30 ` Christian Ebner
2024-06-28 12:09 ` Wolfgang Bumiller
2024-06-28 12:20 ` Christian Ebner
2024-06-28 12:25 ` Lukas Wagner
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=20240624142415.41470-1-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/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