Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: runtime: core_chunk_trace: Check callback struct member's valu…
…es strictly Without this check, the following weird error is occurred intermittently: ```log [0] dummy.0: [1664938706.407551000, {"message"=>"dummy"}] [2022/10/05 11:58:27] [ info] [test] flush record flb-rt-core_chunk_trace(32205,0x16fe87000) malloc: *** error for object 0x600002600074: pointer being realloc'd was not allocated flb-rt-core_chunk_trace(32205,0x16fe87000) malloc: *** set a breakpoint in malloc_error_break to debug ``` The main reason is, num_records index is broken in some cases: ``` flb-rt-core_chunk_trace(32205,0x16fe87000) malloc: *** error for object 0x600002600074: pointer being realloc'd was not allocated flb-rt-core_chunk_trace(32205,0x16fe87000) malloc: *** set a breakpoint in malloc_error_break to debug [2022/10/05 11:58:27] [ info] [input] pausing dummy.0 Process 32205 stopped * thread #2, name = 'flb-pipeline', stop reason = breakpoint 1.1 frame #0: 0x00000001b34a3120 libsystem_malloc.dylib`malloc_error_break libsystem_malloc.dylib`malloc_error_break: -> 0x1b34a3120 <+0>: pacibsp 0x1b34a3124 <+4>: stp x29, x30, [sp, #-0x10]! 0x1b34a3128 <+8>: mov x29, sp 0x1b34a312c <+12>: nop Target 0: (flb-rt-core_chunk_trace) stopped. (lldb) bt * thread #2, name = 'flb-pipeline', stop reason = breakpoint 1.1 * frame #0: 0x00000001b34a3120 libsystem_malloc.dylib`malloc_error_break frame #1: 0x00000001b3494844 libsystem_malloc.dylib`malloc_vreport + 428 frame #2: 0x00000001b3497f34 libsystem_malloc.dylib`malloc_report + 64 frame #3: 0x00000001b3488210 libsystem_malloc.dylib`realloc + 328 frame #4: 0x0000000100006154 flb-rt-core_chunk_trace`flb_realloc(ptr=0x0000600002600074, size=18446744064764412176) at flb_mem.h:94:12 frame #5: 0x0000000100005fc8 flb-rt-core_chunk_trace`callback_add_record(data=0x0000600003014000, size=135, cb_data=0x0000600000004010) at core_chunk_trace.c:51:28 frame #6: 0x00000001001268b0 flb-rt-core_chunk_trace`out_lib_flush(event_chunk=0x0000600000c14000, out_flush=0x0000600001714000, i_ins=0x0000000100b09ab0, out_context=0x0000600000204a80, config=0x000000010181d200) at out_lib.c:197:9 frame #7: 0x0000000100029d70 flb-rt-core_chunk_trace`output_pre_cb_flush at flb_output.h:517:5 frame #8: 0x000000010044fa64 flb-rt-core_chunk_trace`co_switch(handle=0x000000010044fa64) at aarch64.c:133:4 (lldb) frane select 5 error: 'frane' is not a valid command. (lldb) frame select 5 frame #5: 0x0000000100005fc8 flb-rt-core_chunk_trace`callback_add_record(data=0x0000600003014000, size=135, cb_data=0x0000600000004010) at core_chunk_trace.c:51:28 48 flb_calloc(1, sizeof(struct callback_record)); 49 } else { 50 ctx->records = (struct callback_record *) -> 51 flb_realloc(ctx->records, 52 (ctx->num_records+1)*sizeof(struct callback_record)); 53 } 54 if (ctx->records == NULL) { (lldb) po ctx->records 0x0000600002600074 (lldb) po ctx->records 0x0000600002600074 (lldb) po ctx->num_records -559071216 ``` Signed-off-by: Hiroshi Hatake <[email protected]>
- Loading branch information