filter_multiline: synchronize buffered output-processor appends with the flush timer
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C
- Estrellas
- 8.2k
- Forks
- 2k
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 99
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fluent/fluent-bit
-
in_tail: files falsely detected as rotated on macOS with threaded inputs, causing duplicate recordsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
fluent/fluent-bit#12780 ·
Los mantenedores suelen responder en 1 día
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fluent/fluent-bit#12683 · 2 comentarios · 6 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
fluent/fluent-bit#12657 ·
Los mantenedores suelen responder en 1 día
-
http: Transfer-Encoding chunked plus Content-Length hangs forever (CL branch shadows the chunked path)Posiblemente ocupada @sarankumar1325 la tomó hace 14 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
fluent/fluent-bit#12656 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
fluent/fluent-bit#12649 ·
Los mantenedores suelen responder en 1 día
Todos los issues de fluent/fluent-bit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
micropython/micropython#19942 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
快速入门那里会不会对新手不太友好,提出优化方案Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
-
-disable-symbolserver is ignored on macOS/Linux: PDBs are still downloaded from msdl.microsoft.comAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100