filter_multiline: synchronize buffered output-processor appends with the flush timer
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
Start with plugins/filter_multiline/ml.c and trace cb_ml_filter(), get_or_create_stream(), flush_callback(), and shutdown alongside the multiline core append and auto-flush paths. Then inspect output worker dispatch in flb_output.c and flb_output.h, and the runtime tests named in the issue. Done means real multi-worker dispatch and timer flushes are covered, records flush correctly, shutdown is safe, classic-filter and input-processor tests pass, and ThreadSanitizer reports no races.
索引モデルが issue の本文から書いたものです。
説明
Summary
Track the pre-existing synchronization problem when buffered multiline parser mode runs as an output processor.
As identified in the discussion on PR #12678, output processors execute from output flush helpers on worker threads, while cb_ml_init() initializes the multiline auto-flush timer on the main scheduler. The worker path and timer can therefore access the same multiline state concurrently.
get_or_create_stream() mutates ctx->ml_streams, and flb_ml_append_event() mutates parser group buffers. The timer flush path reads or modifies that state and invokes flush_callback(), which looks up stream metadata through get_by_id().
This can cause data races and inconsistent stream or parser state. This issue tracks the synchronization concern; no runtime crash reproduction is claimed here.
Scope and required changes
- Establish safe ownership or synchronization for buffered multiline parser state when used as an output processor.
- Serialize stream creation, lookup, list mutation, and parser appends with timer-driven flushes. Account for concurrent output workers sharing the processor context.
- Review flush callbacks, emitter interactions, and shutdown/destruction under the same ownership model. Avoid deadlocks or callback re-entry problems.
- Document the threading contract and preserve existing classic-filter and input-processor behavior.
- Add regression coverage that exercises real output worker dispatch concurrently with timer flushes.
Possible approaches include a shared synchronization mechanism or confining parser operations and timer flushes to one owner thread. The implementation should select and document the appropriate approach.
Affected areas
plugins/filter_multiline/ml.c:cb_ml_init(),cb_ml_filter(),get_or_create_stream(),get_by_id(),flush_callback(), and shutdown/destruction.- Multiline core auto-flush and append paths.
- Output processor initialization and output flush helpers (
flb_output.candflb_output.h). tests/runtime/filter_multiline.cand appropriate output-processor runtime coverage.
Acceptance criteria
- Output-worker appends and timer flushes cannot access shared stream lists or parser buffers without synchronization or single-thread ownership.
- Tests exercise actual output worker dispatch, including multiple workers, while timer flushes occur. Do not use a formatter test hook that bypasses worker dispatch.
- Tests verify correct multiline concatenation and pending-content flushing without missing or duplicate records.
- A ThreadSanitizer run of the concurrency regression reports no races in the affected multiline state.
- Shutdown completes without deadlocks or invalid memory access.
- Classic-filter and input-processor multiline tests continue to pass.
Relationship to PR #12678
This is separate from idle-stream eviction. PR #12678 disables idle eviction for output processors to avoid adding stream frees to the existing race. Disabling eviction does not serialize existing appends and timer flushes. Keep that safeguard until output-processor stream lifecycle safety is established; enabling eviction is not required by this issue.
Requested by @baizhenyu.
- PR: https://github.com/fluent/fluent-bit/pull/12678
- Follow-up request and discussion: https://github.com/fluent/fluent-bit/pull/12678#discussion_r4404183221
- Earlier review discussion: https://github.com/fluent/fluent-bit/pull/12678#discussion_r4404123548
- 主要言語
- C
- スター
- 8.2k
- フォーク
- 2k
- 平均マージ
- 3日 20時間
- マージ済み PR(30日)
- 99
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fluent/fluent-bit のほかの issue
-
in_tail: files falsely detected as rotated on macOS with threaded inputs, causing duplicate records対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fluent/fluent-bit#12780 ·
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fluent/fluent-bit#12683 · コメント 2 件 · リアクション 6 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fluent/fluent-bit#12657 ·
メンテナーはふだん 1 日以内に返信
-
http: Transfer-Encoding chunked plus Content-Length hangs forever (CL branch shadows the chunked path)対応中かも @sarankumar1325 が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fluent/fluent-bit#12656 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
fluent/fluent-bit#12649 ·
メンテナーはふだん 1 日以内に返信
fluent/fluent-bit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
micropython/micropython#19942 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
-disable-symbolserver is ignored on macOS/Linux: PDBs are still downloaded from msdl.microsoft.comオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100