Skip to content

config: fix duplicate config file loading in config_include_dir#5228

Merged
Watson1978 merged 7 commits into
fluent:masterfrom
Watson1978:conf.d
Jan 20, 2026
Merged

config: fix duplicate config file loading in config_include_dir#5228
Watson1978 merged 7 commits into
fluent:masterfrom
Watson1978:conf.d

Conversation

@Watson1978

@Watson1978 Watson1978 commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #

Ref. #5100

What this PR does / why we need it:
Currently, if a user explicitly @includes a file that is also located
in config_include_dir, the file is loaded twice.
This causes startup failures due to port conflicts or ID duplication.

This commit introduces a deduplication mechanism using a callback:

  1. Add on_file_parsed callback to Fluent::Config.build to track files loaded during the user config parsing phase.
  2. In Supervisor, record loaded files via this callback.
  3. When expanding config_include_dir, skip files that have already been loaded in the user configuration.

Docs Changes:

Release Note:

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 force-pushed the conf.d branch 2 times, most recently from 3215bf9 to 06b7380 Compare January 15, 2026 01:40
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Comment thread lib/fluent/config/v1_parser.rb

@kenhys kenhys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just brief review.

Comment thread test/test_supervisor.rb
Comment thread test/test_supervisor.rb
@Watson1978 Watson1978 marked this pull request as ready for review January 15, 2026 09:29
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 added the backport to v1.19 We will backport this fix to the LTS branch label Jan 16, 2026
@Watson1978 Watson1978 added this to the v1.20.0 milestone Jan 16, 2026

@kenhys kenhys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@Watson1978 Watson1978 merged commit a60bede into fluent:master Jan 20, 2026
21 checks passed
@Watson1978 Watson1978 deleted the conf.d branch January 20, 2026 00:48
github-actions Bot pushed a commit that referenced this pull request Jan 25, 2026
**Which issue(s) this PR fixes**:
Fixes #

Ref. https://github.com/fluent/fluentd/discussions/5100

**What this PR does / why we need it**:
Currently, if a user explicitly `@include`s a file that is also located
in `config_include_dir`, the file is loaded twice.
This causes startup failures due to port conflicts or ID duplication.

This commit introduces a deduplication mechanism using a callback:

1. Add `on_file_parsed` callback to `Fluent::Config.build` to track
files loaded during the user config parsing phase.
2. In `Supervisor`, record loaded files via this callback.
3. When expanding `config_include_dir`, skip files that have already
been loaded in the user configuration.

**Docs Changes**:

**Release Note**:

---------

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kenhys pushed a commit that referenced this pull request Jan 26, 2026
…include_dir (#5228) (#5235)

**Which issue(s) this PR fixes**: 
Backport #5228
Fixes #

Ref. https://github.com/fluent/fluentd/discussions/5100

**What this PR does / why we need it**: 
Currently, if a user explicitly `@include`s a file that is also located
in `config_include_dir`, the file is loaded twice.
This causes startup failures due to port conflicts or ID duplication.

This commit introduces a deduplication mechanism using a callback:

1. Add `on_file_parsed` callback to `Fluent::Config.build` to track
files loaded during the user config parsing phase.
2. In `Supervisor`, record loaded files via this callback.
3. When expanding `config_include_dir`, skip files that have already
been loaded in the user configuration.

**Docs Changes**:

**Release Note**:

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 added the backported "backport to LTS" is done label Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.19 We will backport this fix to the LTS branch backported "backport to LTS" is done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants