From 927dbe312fce573692b24b43beda0c65312640e3 Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 18 Nov 2025 21:23:01 -0800 Subject: [PATCH] Added marshaling error handling --- weed/util/log_buffer/log_buffer.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.go index aadc68a73..6c71a971e 100644 --- a/weed/util/log_buffer/log_buffer.go +++ b/weed/util/log_buffer/log_buffer.go @@ -278,7 +278,11 @@ func (logBuffer *LogBuffer) AddLogEntryToBuffer(logEntry *filer_pb.LogEntry) { logBuffer.LastTsNs.Store(processingTsNs) } - logEntryData, _ := proto.Marshal(logEntry) + logEntryData, marshalErr := proto.Marshal(logEntry) + if marshalErr != nil { + glog.Errorf("Failed to marshal LogEntry: %v", marshalErr) + return + } size := len(logEntryData) if logBuffer.pos == 0 { @@ -377,7 +381,11 @@ func (logBuffer *LogBuffer) AddDataToBuffer(partitionKey, data []byte, processin logEntry.Offset = logBuffer.offset // Marshal with correct timestamp and offset - logEntryData, _ := proto.Marshal(logEntry) + logEntryData, marshalErr := proto.Marshal(logEntry) + if marshalErr != nil { + glog.Errorf("Failed to marshal LogEntry: %v", marshalErr) + return + } size := len(logEntryData)