engine_dispatch: Address stale failed tasks on dispatch - #12254
engine_dispatch: Address stale failed tasks on dispatch#12254cosmo0920 wants to merge 4 commits into
Conversation
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
📝 WalkthroughWalkthroughThe retry dispatch failure path now records retry and drop metrics before it destroys the failed retry and releases the task reference. Internal tests cover task ownership, retry preservation, chunk registration, metrics, and task ID reuse. ChangesRetry dispatch failure
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/internal/engine_dispatch.c (1)
30-32: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the required control-statement brace style.
Move the opening brace to the next line for each new
if,else,while, anddoblock in this file. Line 30 is one example.Proposed fix
- if (ctx == NULL) { + if (ctx == NULL) + { return; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/internal/engine_dispatch.c` around lines 30 - 32, Update the control statements in engine_dispatch.c to place opening braces on the following line for every if, else, while, and do block, including the block guarding ctx == NULL. Preserve all existing logic and formatting otherwise.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/internal/engine_dispatch.c`:
- Around line 28-48: The test fixture must balance Winsock lifecycle management.
Update test_ctx_create to check the WSAStartup result and record successful
initialization in test_ctx; update test_ctx_destroy to call WSACleanup only when
initialization succeeded, after resource teardown, while preserving cleanup for
failed or partially initialized fixtures.
---
Nitpick comments:
In `@tests/internal/engine_dispatch.c`:
- Around line 30-32: Update the control statements in engine_dispatch.c to place
opening braces on the following line for every if, else, while, and do block,
including the block guarding ctx == NULL. Preserve all existing logic and
formatting otherwise.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e0471cc7-4f77-4584-8ece-706754020b33
📒 Files selected for processing (3)
src/flb_engine_dispatch.ctests/internal/CMakeLists.txttests/internal/engine_dispatch.c
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e01062fbe6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/internal/engine_dispatch.c (1)
89-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the required control-block brace style.
Move each opening brace to the next line.
tests/internal/engine_dispatch.c#L89-L94: Move theif (ret != 0)opening brace.tests/internal/engine_dispatch.c#L139-L161: Move the counter-allocation failure-block opening brace.tests/internal/engine_dispatch.c#L166-L178: Move the metrics-allocation failure-block opening brace.tests/internal/engine_dispatch.c#L187-L190: Move the metrics cleanup-block opening brace.tests/internal/engine_dispatch.c#L236-L244: Move the metric null-check opening braces.tests/internal/engine_dispatch.c#L283-L292: Move the task-event-chunk and route-allocation failure-block opening braces.tests/internal/engine_dispatch.c#L333-L338: Move the output initialization failure-block opening brace.tests/internal/engine_dispatch.c#L385-L390: Move the output initialization failure-block opening brace.tests/internal/engine_dispatch.c#L451-L456: Move the output initialization failure-block opening brace.tests/internal/engine_dispatch.c#L470-L481: Move the allocation failure-block opening brace.As per coding guidelines: “Put function opening braces on the next line.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/internal/engine_dispatch.c` around lines 89 - 94, Apply the required next-line brace style in tests/internal/engine_dispatch.c at lines 89-94, 139-161, 166-178, 187-190, 236-244, 283-292, 333-338, 385-390, 451-456, and 470-481: move each listed if/else failure, cleanup, null-check, and allocation-block opening brace onto its own following line, without changing control flow or behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/internal/engine_dispatch.c`:
- Around line 89-94: Apply the required next-line brace style in
tests/internal/engine_dispatch.c at lines 89-94, 139-161, 166-178, 187-190,
236-244, 283-292, 333-338, 385-390, 451-456, and 470-481: move each listed
if/else failure, cleanup, null-check, and allocation-block opening brace onto
its own following line, without changing control flow or behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 09d52167-1e44-4865-94be-373d3a9506a7
📒 Files selected for processing (2)
src/flb_engine_dispatch.ctests/internal/engine_dispatch.c
🚧 Files skipped from review as they are similar to previous changes (1)
- src/flb_engine_dispatch.c
Implemented the stale-task cleanup.
Changes:
src/flb_engine_dispatch.c:72now callsflb_task_users_release(task)after destroying the failed retry.tests/internal/engine_dispatch.ccovering:tests/internal/CMakeLists.txt.Verification:
Result: both tests passed, 0 failures.
The regression test was also built and run temporarily without the production fix. It failed on the occupied task-map slot, retained task/chunk lists, and non-reused task ID. After restoring the fix, it passed.
No Python integration scenario covers this engine-dispatch lifecycle path.
Closes #12252.
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.
Summary by CodeRabbit
Bug Fixes
Tests