Skip to content

in_tail: Another attempt to plug segv on in tail#12010

Open
cosmo0920 wants to merge 2 commits into
masterfrom
cosmo0920-another-attempt-to-plug-segv-on-in_tail
Open

in_tail: Another attempt to plug segv on in tail#12010
cosmo0920 wants to merge 2 commits into
masterfrom
cosmo0920-another-attempt-to-plug-segv-on-in_tail

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

In threaded mode, we need to pause ingesting evens chunks.
This is because with threaded mode, we must confirm the buffers on plugins whether are paused or not.
This PR adds this type of checks on ingestion.

Closes #12009.


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:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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
    • Tail input processing now immediately stops extra file-event reconciliation and related progress signaling when the input is paused, reducing unnecessary work during pause.
    • Threaded inotify tail collectors now pause and resume more reliably in sync with the input state.
  • Tests
    • Added a new threaded inotify pause/resume runtime test to verify fs1 and progress-check collectors correctly transition between running and non-running states.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5b56669-ebd9-4dd3-8873-d5b37eb48409

📥 Commits

Reviewing files that changed from the base of the PR and between c2bc93f and f816644.

📒 Files selected for processing (2)
  • plugins/in_tail/tail_fs_inotify.c
  • tests/runtime/in_tail.c
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/in_tail/tail_fs_inotify.c
  • tests/runtime/in_tail.c

📝 Walkthrough

Walkthrough

Adds a paused-input early return in the inotify progress callback and a runtime test that checks threaded tail collectors stop on pause and resume on unpause.

Changes

inotify pause/resume guard and test

Layer / File(s) Summary
Pause-aware progress callback
plugins/in_tail/tail_fs_inotify.c
in_tail_progress_check_callback returns 0 immediately when the input buffer is paused, skipping file reconciliation and pending-data signaling.
Threaded pause/resume collector test
tests/runtime/in_tail.c
Adds wait_tail_collectors_state(), flb_test_inotify_threaded_pause_collectors(), and the inotify_threaded_pause_collectors entry in TEST_LIST; the test pauses and resumes a threaded tail input and checks both collectors’ running state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • fluent/fluent-bit#11750: Modifies the same inotify progress-check path in plugins/in_tail/tail_fs_inotify.c.
  • fluent/fluent-bit#11956: Also changes inotify progress-check and pause/resume behavior in tail_fs_inotify.c and adds related pause testing.

Suggested reviewers

  • edsiper

Poem

🐇 The tail went quiet when paused in the breeze,
no files to reconcile, no restless degrees.
Hop, then resume — collectors wake bright,
and inotify bounces through day and night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the in_tail SIGSEGV fix, but it is vague and does not clearly state the pause-aware threaded collector change.
Linked Issues check ✅ Passed The changes add pause-aware early exit logic and a threaded collector pause/resume test, which directly target the reported in_tail crash path.
Out of Scope Changes check ✅ Passed The patch stays within in_tail runtime logic and its tests, with no obvious unrelated or extraneous changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-another-attempt-to-plug-segv-on-in_tail

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2bc93ffce

ℹ️ 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".

Comment thread plugins/in_tail/tail_fs_inotify.c Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@plugins/in_tail/tail_fs_inotify.c`:
- Around line 306-308: The early pause check in flb_tail_inotify_cb is skipping
processing after the inotify event has already been read, which can drop
IN_Q_OVERFLOW handling. Move or adjust the flb_input_buf_paused(ctx->ins) guard
so IN_Q_OVERFLOW still reaches the branch that calls reconcile_all_files() and
flb_tail_scan(), preserving recovery even when input is paused.
🪄 Autofix (Beta)

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

Run ID: 6a3af47e-c6ac-4228-a386-8f187b3c7ec0

📥 Commits

Reviewing files that changed from the base of the PR and between f317143 and c2bc93f.

📒 Files selected for processing (2)
  • plugins/in_tail/tail_fs_inotify.c
  • tests/runtime/in_tail.c

Comment thread plugins/in_tail/tail_fs_inotify.c Outdated
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in_tail: SIGSEGV in flb_lib_worker (flb_lib.c:909) persists on 5.0.8 under HTTP/OSIS 408 + circuit-breaker backpressure (follow-up to #11954)

1 participant