Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ml: add mutex for flb_ml_stream_group
To fix following race. ================== WARNING: ThreadSanitizer: data race (pid=15218) Read of size 8 at 0x7b2000008398 by thread T1: #0 flb_ml_flush_stream_group /home/taka/git/fluent-bit/src/multiline/flb_ml.c:1025 (fluent-bit+0x1930ba) #1 flb_ml_flush_parser_instance /home/taka/git/fluent-bit/src/multiline/flb_ml.c:116 (fluent-bit+0x1907ce) #2 flb_ml_flush_pending /home/taka/git/fluent-bit/src/multiline/flb_ml.c:136 (fluent-bit+0x1908e4) #3 cb_ml_flush_timer /home/taka/git/fluent-bit/src/multiline/flb_ml.c:162 (fluent-bit+0x1909e9) #4 flb_sched_event_handler /home/taka/git/fluent-bit/src/flb_scheduler.c:428 (fluent-bit+0x139c4a) #5 flb_engine_start /home/taka/git/fluent-bit/src/flb_engine.c:937 (fluent-bit+0x12612e) #6 flb_lib_worker /home/taka/git/fluent-bit/src/flb_lib.c:629 (fluent-bit+0xa0ccd) Previous write of size 8 at 0x7b2000008398 by thread T3: #0 calloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:672 (libtsan.so.0+0x31edc) #1 flb_calloc /home/taka/git/fluent-bit/include/fluent-bit/flb_mem.h:89 (fluent-bit+0x2272f4) #2 stream_group_create /home/taka/git/fluent-bit/src/multiline/flb_ml_stream.c:52 (fluent-bit+0x22c3fb) #3 flb_ml_stream_group_get /home/taka/git/fluent-bit/src/multiline/flb_ml_stream.c:126 (fluent-bit+0x22c799) #4 package_content /home/taka/git/fluent-bit/src/multiline/flb_ml.c:229 (fluent-bit+0x190bf6) #5 process_append /home/taka/git/fluent-bit/src/multiline/flb_ml.c:499 (fluent-bit+0x191782) #6 ml_append_try_parser /home/taka/git/fluent-bit/src/multiline/flb_ml.c:659 (fluent-bit+0x191f1a) #7 flb_ml_append /home/taka/git/fluent-bit/src/multiline/flb_ml.c:699 (fluent-bit+0x1920f7) #8 process_content /home/taka/git/fluent-bit/plugins/in_tail/tail_file.c:456 (fluent-bit+0x342854) #9 flb_tail_file_chunk /home/taka/git/fluent-bit/plugins/in_tail/tail_file.c:1341 (fluent-bit+0x346ef7) #10 in_tail_collect_static /home/taka/git/fluent-bit/plugins/in_tail/tail.c:188 (fluent-bit+0x324ee3) #11 input_collector_fd /home/taka/git/fluent-bit/src/flb_input_thread.c:168 (fluent-bit+0xe0369) #12 engine_handle_event /home/taka/git/fluent-bit/src/flb_input_thread.c:183 (fluent-bit+0xe10e5) #13 input_thread /home/taka/git/fluent-bit/src/flb_input_thread.c:384 (fluent-bit+0xe10e5) #14 step_callback /home/taka/git/fluent-bit/src/flb_worker.c:43 (fluent-bit+0x157a02) Location is heap block of size 120 at 0x7b2000008380 allocated by thread T3: #0 calloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:672 (libtsan.so.0+0x31edc) #1 flb_calloc /home/taka/git/fluent-bit/include/fluent-bit/flb_mem.h:89 (fluent-bit+0x2272f4) #2 stream_group_create /home/taka/git/fluent-bit/src/multiline/flb_ml_stream.c:52 (fluent-bit+0x22c3fb) #3 flb_ml_stream_group_get /home/taka/git/fluent-bit/src/multiline/flb_ml_stream.c:126 (fluent-bit+0x22c799) #4 package_content /home/taka/git/fluent-bit/src/multiline/flb_ml.c:229 (fluent-bit+0x190bf6) #5 process_append /home/taka/git/fluent-bit/src/multiline/flb_ml.c:499 (fluent-bit+0x191782) #6 ml_append_try_parser /home/taka/git/fluent-bit/src/multiline/flb_ml.c:659 (fluent-bit+0x191f1a) #7 flb_ml_append /home/taka/git/fluent-bit/src/multiline/flb_ml.c:699 (fluent-bit+0x1920f7) #8 process_content /home/taka/git/fluent-bit/plugins/in_tail/tail_file.c:456 (fluent-bit+0x342854) #9 flb_tail_file_chunk /home/taka/git/fluent-bit/plugins/in_tail/tail_file.c:1341 (fluent-bit+0x346ef7) #10 in_tail_collect_static /home/taka/git/fluent-bit/plugins/in_tail/tail.c:188 (fluent-bit+0x324ee3) #11 input_collector_fd /home/taka/git/fluent-bit/src/flb_input_thread.c:168 (fluent-bit+0xe0369) #12 engine_handle_event /home/taka/git/fluent-bit/src/flb_input_thread.c:183 (fluent-bit+0xe10e5) #13 input_thread /home/taka/git/fluent-bit/src/flb_input_thread.c:384 (fluent-bit+0xe10e5) #14 step_callback /home/taka/git/fluent-bit/src/flb_worker.c:43 (fluent-bit+0x157a02) Thread T1 'flb-pipeline' (tid=15220, running) created by main thread at: #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8) #1 mk_utils_worker_spawn /home/taka/git/fluent-bit/lib/monkey/mk_core/mk_utils.c:284 (fluent-bit+0xbfb422) #2 flb_main /home/taka/git/fluent-bit/src/fluent-bit.c:1231 (fluent-bit+0x871d1) #3 main /home/taka/git/fluent-bit/src/fluent-bit.c:1257 (fluent-bit+0x8732e) Thread T3 'flb-in-tail.0-w' (tid=15222, running) created by thread T1 at: #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8) #1 mk_utils_worker_spawn /home/taka/git/fluent-bit/lib/monkey/mk_core/mk_utils.c:284 (fluent-bit+0xbfb422) #2 flb_tp_thread_start /home/taka/git/fluent-bit/src/flb_thread_pool.c:123 (fluent-bit+0x170237) #3 flb_input_thread_instance_init /home/taka/git/fluent-bit/src/flb_input_thread.c:543 (fluent-bit+0xe1cca) #4 flb_input_instance_init /home/taka/git/fluent-bit/src/flb_input.c:1129 (fluent-bit+0xd73a4) #5 flb_input_init_all /home/taka/git/fluent-bit/src/flb_input.c:1216 (fluent-bit+0xd7877) #6 flb_engine_start /home/taka/git/fluent-bit/src/flb_engine.c:717 (fluent-bit+0x1252fe) #7 flb_lib_worker /home/taka/git/fluent-bit/src/flb_lib.c:629 (fluent-bit+0xa0ccd) SUMMARY: ThreadSanitizer: data race /home/taka/git/fluent-bit/src/multiline/flb_ml.c:1025 in flb_ml_flush_stream_group ================== Signed-off-by: Takahiro Yamashita <[email protected]>
- Loading branch information