@@ -287,7 +287,8 @@ int flb_input_chunk_has_overlimit_routes(struct flb_input_chunk *ic,
287
287
continue ;
288
288
}
289
289
290
- flb_debug ("[input chunk] chunk %s required %ld bytes and %ld bytes left in plugin %s" ,
290
+ flb_debug ("[input chunk] chunk %s required %ld bytes and %ld bytes left "
291
+ "in plugin %s" ,
291
292
flb_input_chunk_get_name (ic ), chunk_size ,
292
293
o_ins -> total_limit_size - o_ins -> fs_chunks_size ,
293
294
o_ins -> name );
@@ -477,8 +478,9 @@ struct flb_input_chunk *flb_input_chunk_create(struct flb_input_instance *in,
477
478
int flb_input_chunk_destroy (struct flb_input_chunk * ic , int del )
478
479
{
479
480
int tag_len ;
481
+ int ret ;
480
482
ssize_t bytes ;
481
- const char * tag_buf ;
483
+ const char * tag_buf = NULL ;
482
484
struct mk_list * head ;
483
485
struct flb_output_instance * o_ins ;
484
486
@@ -499,10 +501,28 @@ int flb_input_chunk_destroy(struct flb_input_chunk *ic, int del)
499
501
}
500
502
}
501
503
504
+ /*
505
+ * When a chunk is going to be destroyed, this can be in a down state,
506
+ * since the next step is to retrieve the Tag we need to have the
507
+ * content up.
508
+ */
509
+ ret = flb_input_chunk_is_up (ic );
510
+ if (ret == FLB_FALSE ) {
511
+ ret = cio_chunk_up_force (ic -> chunk );
512
+ if (ret == -1 ) {
513
+ flb_error ("[input chunk] cannot load chunk: %s" ,
514
+ flb_input_chunk_get_name (ic ));
515
+ }
516
+ }
517
+
502
518
/* Retrieve Tag */
503
- flb_input_chunk_get_tag (ic , & tag_buf , & tag_len );
519
+ ret = flb_input_chunk_get_tag (ic , & tag_buf , & tag_len );
520
+ if (ret == -1 ) {
521
+ flb_trace ("[input chunk] could not retrieve chunk tag: %s" ,
522
+ flb_input_chunk_get_name (ic ));
523
+ }
504
524
505
- if (del == CIO_TRUE ) {
525
+ if (del == CIO_TRUE && tag_buf ) {
506
526
/*
507
527
* "TRY" to delete any reference to this chunk ('ic') from the hash
508
528
* table. Note that maybe the value is not longer available in the
0 commit comments