From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ronja.mits.lan by ronja.mits.lan with LMTP id 4KcpHKKBeWYqdgAAxxbTJA (envelope-from ); Mon, 24 Jun 2024 16:24:34 +0200 Received: from proxmox-new.maurer-it.com (unknown [192.168.2.33]) by ronja.mits.lan (Postfix) with ESMTPS id 58CFAF6459A; Mon, 24 Jun 2024 16:24:34 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3C75E485CB; Mon, 24 Jun 2024 16:24:34 +0200 (CEST) Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by proxmox-new.maurer-it.com (Proxmox) with ESMTPS; Mon, 24 Jun 2024 16:24:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 83EA437F6A; Mon, 24 Jun 2024 16:24:32 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Mon, 24 Jun 2024 16:24:15 +0200 Message-Id: <20240624142415.41470-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [pbs-devel] [PATCH proxmox-rrd] cache: skip non-utf8 lines in rrd journal X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods MAILING_LIST_MULTI -2 Multiple indicators imply a widely-seen list manager RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record 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 --- 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