Skip to content

Conversation

@ahayworth
Copy link

@ahayworth ahayworth commented Oct 31, 2025

There are certain kinds of invalid configurations that pass the
--dry-run check, but fail to start at run time. This commit addresses
the issue by re-using some of the hot reload validation logic.

For example, this config is trivially invalid, passes --dry-run, and
fails at runtime:

pipeline:
  inputs:
  - name: dummy
    tag: test
    invalid_property_that_does_not_exist: some_value
  outputs:
  - name: stdout
    match: '*'
zsh ❮ fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

configuration test is successful

zsh ❮ fluent-bit -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

[2025/10/31 16:05:55.268532000] [ info] [fluent bit] version=4.1.1, commit=, pid=21037
[2025/10/31 16:05:55.268808000] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/31 16:05:55.269140000] [ info] [simd    ] disabled
[2025/10/31 16:05:55.269147000] [ info] [cmetrics] version=1.0.5
[2025/10/31 16:05:55.269407000] [ info] [ctraces ] version=0.6.6
[2025/10/31 16:05:55.269476000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:05:55.269486000] [ help] try the command: fluent-bit -i dummy -h

[2025/10/31 16:05:55.269515000] [error] [engine] input initialization failed

With this commit, we can see that the additional validation from hot
reload catches the error right away:

zsh ❯ bin/fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.2.0
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

[2025/10/31 16:07:50.402568000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:07:50.402792000] [ help] try the command: bin/fluent-bit -i dummy -h

[2025/10/31 16:07:50.402800000] [error] [reload] check properties for input plugins is failed

(The logs of course now say [reload], which is a little misleading...
we can clean that up, if desired).


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 (included in the commit/PR description)
  • Debug log output from testing the change (included in the commit/PR description)
  • 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.

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

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] 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
    • Dry-run mode now performs full configuration validation, ensures cleanup always runs, and exits immediately on validation failure to prevent invalid configurations from proceeding and to report success only when checks pass.

There are certain kinds of invalid configurations that pass the
`--dry-run` check, but fail to start at run time. This commit addresses
the issue by re-using some of the hot reload validation logic.

For example, this config is trivially invalid, passes `--dry-run`, and
fails at runtime:

```
pipeline:
  inputs:
  - name: dummy
    tag: test
    invalid_property_that_does_not_exist: some_value
  outputs:
  - name: stdout
    match: '*'
```

```
zsh ❮ fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

configuration test is successful

zsh ❮ fluent-bit -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

[2025/10/31 16:05:55.268532000] [ info] [fluent bit] version=4.1.1, commit=, pid=21037
[2025/10/31 16:05:55.268808000] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/31 16:05:55.269140000] [ info] [simd    ] disabled
[2025/10/31 16:05:55.269147000] [ info] [cmetrics] version=1.0.5
[2025/10/31 16:05:55.269407000] [ info] [ctraces ] version=0.6.6
[2025/10/31 16:05:55.269476000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:05:55.269486000] [ help] try the command: fluent-bit -i dummy -h

[2025/10/31 16:05:55.269515000] [error] [engine] input initialization failed
```

With this commit, we can see that the additional validation from hot
reload catches the error right away:

```
zsh ❯ bin/fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.2.0
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _             ___   __
|  ___| |                | |   | ___ (_) |           /   | /  |
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `| |
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |  | |
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |__| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)___/

[2025/10/31 16:07:50.402568000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:07:50.402792000] [ help] try the command: bin/fluent-bit -i dummy -h

[2025/10/31 16:07:50.402800000] [error] [reload] check properties for input plugins is failed
```

(The logs of course now say `[reload]`, which is a little misleading...
we can clean that up, if desired).

Signed-off-by: Andrew Hayworth <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

In dry-run mode, fluent-bit now calls flb_reload_property_check_all(config) to validate properties, always performs cleanup, and exits with failure if the check returns non-zero or prints success and exits normally on zero.

Changes

Cohort / File(s) Change Summary
Dry-run mode validation
src/fluent-bit.c
Added call to flb_reload_property_check_all(config) in the --dry-run path; result is stored, cleanup always runs, non-zero causes exit(failure), zero prints success and exits normally.

Sequence Diagram

sequenceDiagram
    participant User
    participant App as fluent-bit (--dry-run)
    participant Validator as flb_reload_property_check_all

    User->>App: Start with --dry-run
    Note over App: New validation step before final exit
    App->>Validator: flb_reload_property_check_all(config)

    alt Validation fails (non-zero)
        Validator-->>App: fail (non-zero)
        Note over App: Run cleanup then exit with failure
        App->>App: Destroy config / cleanup
        App->>User: Exit (failure)
    else Validation succeeds (zero)
        Validator-->>App: success (zero)
        Note over App: Run cleanup, print success, exit normally
        App->>App: Destroy config / cleanup
        App->>User: Print "configuration test succeeded" / Exit (success)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-file change with a small conditional and guaranteed cleanup.
  • Review attention:
    • Confirm flb_reload_property_check_all() return semantics and side effects.
    • Verify cleanup always runs and exit codes/messages are correct.

Poem

🐰 I hop through configs, checking each line,

I tidy the burrow, make sure things align,
Dry-run now listens if properties sway,
I blink, I clean — then cheer or stray. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'bin: run additional validation for --dry-run' clearly and concisely describes the main change in the changeset. The change adds additional validation checks during dry-run mode by reusing hot-reload validation logic, which aligns directly with what the title conveys. The title is specific, avoids vague terminology, and accurately summarizes the primary modification.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d255f8 and 538df01.

📒 Files selected for processing (1)
  • src/fluent-bit.c (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/fluent-bit.c

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93d3fb3 and 57442a0.

📒 Files selected for processing (1)
  • src/fluent-bit.c (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/fluent-bit.c (1)
src/flb_reload.c (1)
  • flb_reload_property_check_all (208-245)

@edsiper
Copy link
Member

edsiper commented Nov 1, 2025

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

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

We need to perform the same partial initialization and releasing of
resources whether or not the dry-run was successful, so this commit
ensures that we call those functions before exiting either way.

Signed-off-by: Andrew Hayworth <[email protected]>
@ahayworth ahayworth force-pushed the ahayworth/sc-149733/additional-dry-run-validation branch from 4d255f8 to 538df01 Compare November 3, 2025 16:36
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.

2 participants