Repository navigation
output: fail initialization when a worker thread cannot start - #12901
estebanpavansarquis wants to merge 5 commits into
Conversation
Signed-off-by: estebanpavansarquis <11792494+estebanpavansarquis@users.noreply.github.com>
Stop at the first thread that fails to start so callers can fail instead of dispatching work to a thread that does not run. Signed-off-by: estebanpavansarquis <11792494+estebanpavansarquis@users.noreply.github.com>
Signed-off-by: estebanpavansarquis <11792494+estebanpavansarquis@users.noreply.github.com>
Release the thread pool, joining the workers that started, so the output is not left dispatching tasks to a worker that never runs. Signed-off-by: estebanpavansarquis <11792494+estebanpavansarquis@users.noreply.github.com>
Wrap pthread_create() on Linux to fail the second worker and check that enabling multi-threading fails and releases the pool. Signed-off-by: estebanpavansarquis <11792494+estebanpavansarquis@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
When an output worker thread fails to start, the error is ignored: the output is treated as ready and round-robin keeps assigning tasks to the worker that never runs, so those tasks never complete.
flb_tp_thread_start_all()stops at the first thread that fails to start and returns -1.flb_output_thread_pool_start()returns that result.flb_output_enable_multi_threading()releases the pool on start failure (joining the workers that started) and returns -1, so output initialization fails withcould not start thread pool for '<name>' plugin. Releasing the pool there also covers the Go proxy path, where the instance is destroyed right aftercb_initfails.flb_worker_create()releases the worker log cache when the thread cannot be spawned. The new test reaches that path and LeakSanitizer reports it otherwise.output_thread: worker_start_failure_is_reportedwrapspthread_create()(Linux, GNU/Clang) to fail the second of two workers. It linksfluent-bit-static, likeflb-it-network_dns, because--wrapdoes not reach calls inside the shared library.Fixes #12894
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Testing details
Configuration (same as #12894):
Run with
docker run --pids-limit 4 ...so the second worker cannot be created. Startup now fails and the started worker is joined (exit code 255):Without the PID limit both workers start and all tasks complete (
service has stopped (0 pending tasks)).Unit tests (Debian bookworm, aarch64):
flb-it-output_thread: the new test fails on master (ret == -1,output.tp == NULLand the started worker exit checks) and passes with this change, also with-DSANITIZE_ADDRESS=On.ctest -L internal: 109/109 passed.Summary by CodeRabbit