From 97e2d20c23da61b87d48ba5aad6804c2786ba32f Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Fri, 29 Dec 2023 13:14:41 -0600 Subject: [PATCH] in_storage_backlog: if a chunk tag cannot be read, delete it Signed-off-by: Eduardo Silva --- plugins/in_storage_backlog/sb.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/in_storage_backlog/sb.c b/plugins/in_storage_backlog/sb.c index 1380caf8abb..f0956d324b7 100644 --- a/plugins/in_storage_backlog/sb.c +++ b/plugins/in_storage_backlog/sb.c @@ -256,7 +256,6 @@ static int sb_append_chunk_to_segregated_backlog(struct cio_chunk *target_chu struct sb_out_chunk *chunk; chunk = sb_allocate_chunk(target_chunk, stream, target_chunk_size); - if (chunk == NULL) { flb_errno(); return -1; @@ -378,7 +377,16 @@ int sb_segregate_chunks(struct flb_config *config) if (ret) { /* * if the chunk could not be segregated, just remove it from the - * queue and continue. + * queue, delete it and continue. + */ + + /* If the tag cannot be read it cannot be routed, let's remove it */ + if (ret == -2) { + cio_chunk_close(chunk, CIO_TRUE); + continue; + } + + /* * * if content size is zero, it's safe to 'delete it'. */