From 4e8e616dad4fb833c50435995dc2aeb85eb83bc2 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 4 Nov 2025 07:26:43 +0000 Subject: [PATCH] logging: load meta before retrieving the recipient_list We had a sponsor report an issue where we'd log an error during processing a log hook. It transpired that the recipient list we were attempting to log was `["metadata is not loaded"]`, which doesn't parse as a valid EnvelopeAddress (see prior commit: 52e2f95e9fceda582192601d5935af6ef94a68d8) This commit fixes up the recipient_list logic in the logging function to avoid taking the error message as the recipient list, and moves the metadata loading to happen just before we try to read the recipient list. This should work around the issue, but a consequence is that we might be holding on to the metadata for that message in RAM for longer than we should; will need to do some thinking about managing the resident status in this situation better. --- crates/kumod/src/logging/disposition.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/kumod/src/logging/disposition.rs b/crates/kumod/src/logging/disposition.rs index 326e3f21..8eef6206 100644 --- a/crates/kumod/src/logging/disposition.rs +++ b/crates/kumod/src/logging/disposition.rs @@ -54,17 +54,18 @@ pub async fn log_disposition(args: LogDisposition<'_>) { return; } + msg.load_meta_if_needed().await.ok(); + let recipient_list = match recipient_list { Some(list) => list, - None => msg - .recipient_list_string() - .unwrap_or_else(|err| vec![format!("{err:#}")]), + None => msg.recipient_list_string().unwrap_or_else(|err| { + tracing::error!("log_disposition: recipient_list_string: {err:#}"); + vec![] + }), }; let mut feedback_report = None; - msg.load_meta_if_needed().await.ok(); - let reception_protocol = msg.get_meta_string("reception_protocol").unwrap_or(None); if kind == RecordType::Reception {