Skip to content

fix(fluentd): pin bigdecimal to 3.3.1 in filters Gemfile to fix Kafka plugin conflict - #2354

Open
pujitha24 wants to merge 2 commits into
kube-logging:masterfrom
pujitha24:auto/issue-2353
Open

pujitha24 wants to merge 2 commits into
kube-logging:masterfrom
pujitha24:auto/issue-2353

Conversation

@pujitha24

Copy link
Copy Markdown
Contributor

Motivation:
Fluentd fails to activate fluent-plugin-kafka at startup with a
Gem::ConflictError. images/fluentd/filters/Gemfile pins bigdecimal to
4.1.3, but fluent-plugin-kafka 0.19.8 (installed via
images/fluentd/outputs/Gemfile) declares bigdecimal (~> 3.1) in its
gemspec, i.e. >= 3.1, < 4.0 - a range 4.1.3 does not satisfy.

This was a regression from a renovate "update all dependencies" bump
(3c51d71) that moved bigdecimal from 3.3.1 to 4.1.3 in the filters
Gemfile alongside unrelated plugin bumps, without accounting for the
cross-Gemfile constraint pulled in by fluent-plugin-kafka. bigdecimal
was originally pinned to 3.3.1 deliberately in 4cc9f08 to fix a
separate JSON-parser-fallback warning.

Approach:
Revert only the bigdecimal line in images/fluentd/filters/Gemfile back
to 3.3.1, and update the corresponding entries in
images/fluentd/filters/Gemfile.lock to match. 3.3.1 is not an
arbitrary choice: images/fluentd/Dockerfile's base stage already
explicitly installs bigdecimal -v 3.3.1, and
images/fluentd/outputs/Gemfile.lock already independently resolves
bigdecimal to 3.3.1 as a transitive dependency of fluent-plugin-kafka.
All three locations are now consistent.

Validation:
This sandbox has no Docker and no Ruby/Bundler toolchain matching the
repo's build (Gemfile.lock requires Bundler 2.5.23 and the image
builds on ruby:4.0.7-alpine; only system ruby 2.6.10 / bundler 1.17.2
were available here), so docker build / bundle install could not
be run locally to regenerate the lockfile or boot Fluentd with the
Kafka plugin. The Gemfile.lock was hand-edited (a version-string
substitution in the two spots referencing bigdecimal's own version;
the existing oj (>= 3.0) constraint on bigdecimal remains satisfied
by 3.3.1, and alphabetical ordering is unaffected). The correctness of
the constraint itself (~> 3.1 excludes 4.1.3, includes 3.3.1) is a
static fact of Ruby's pessimistic version operator, confirmed directly
against fluent-plugin-kafka's resolved dependency in
images/fluentd/outputs/Gemfile.lock. The repository's own CI
(.github/workflows/fluentd-images.yaml, invoked from
dependency-images.yaml) builds the actual base/filters/full Fluentd
images via docker buildx on relevant PRs, which will be the first real
build+install verification of this change.

Report: #2353
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
Assisted-by: claude-sonnet-5 (via Claude Code)


AI assistance: this change was drafted with Claude Code.

Fixes #2353

… plugin conflict

Motivation:
Fluentd fails to activate fluent-plugin-kafka at startup with a
Gem::ConflictError. images/fluentd/filters/Gemfile pins bigdecimal to
4.1.3, but fluent-plugin-kafka 0.19.8 (installed via
images/fluentd/outputs/Gemfile) declares `bigdecimal (~> 3.1)` in its
gemspec, i.e. >= 3.1, < 4.0 - a range 4.1.3 does not satisfy.

This was a regression from a renovate "update all dependencies" bump
(3c51d71) that moved bigdecimal from 3.3.1 to 4.1.3 in the filters
Gemfile alongside unrelated plugin bumps, without accounting for the
cross-Gemfile constraint pulled in by fluent-plugin-kafka. bigdecimal
was originally pinned to 3.3.1 deliberately in 4cc9f08 to fix a
separate JSON-parser-fallback warning.

Approach:
Revert only the bigdecimal line in images/fluentd/filters/Gemfile back
to 3.3.1, and update the corresponding entries in
images/fluentd/filters/Gemfile.lock to match. 3.3.1 is not an
arbitrary choice: images/fluentd/Dockerfile's base stage already
explicitly installs `bigdecimal -v 3.3.1`, and
images/fluentd/outputs/Gemfile.lock already independently resolves
bigdecimal to 3.3.1 as a transitive dependency of fluent-plugin-kafka.
All three locations are now consistent.

Validation:
This sandbox has no Docker and no Ruby/Bundler toolchain matching the
repo's build (Gemfile.lock requires Bundler 2.5.23 and the image
builds on ruby:4.0.7-alpine; only system ruby 2.6.10 / bundler 1.17.2
were available here), so `docker build` / `bundle install` could not
be run locally to regenerate the lockfile or boot Fluentd with the
Kafka plugin. The Gemfile.lock was hand-edited (a version-string
substitution in the two spots referencing bigdecimal's own version;
the existing `oj (>= 3.0)` constraint on bigdecimal remains satisfied
by 3.3.1, and alphabetical ordering is unaffected). The correctness of
the constraint itself (~> 3.1 excludes 4.1.3, includes 3.3.1) is a
static fact of Ruby's pessimistic version operator, confirmed directly
against fluent-plugin-kafka's resolved dependency in
images/fluentd/outputs/Gemfile.lock. The repository's own CI
(.github/workflows/fluentd-images.yaml, invoked from
dependency-images.yaml) builds the actual base/filters/full Fluentd
images via docker buildx on relevant PRs, which will be the first real
build+install verification of this change.

Report: kube-logging#2353
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5 (via Claude Code)
@pujitha24

Copy link
Copy Markdown
Contributor Author

This is rebased and CI is green; let me know if anything would make it easier to review.

@moyifeng2000

Copy link
Copy Markdown

After re-building and running it based on your modifications, it still reported an error.

[error]: Unable to activate fluent-plugin-kafka-0.19.8, because bigdecimal-4.0.1 conflicts with bigdecimal (> 3.1) path=nil error_class=Gem::ConflictError error="Unable to activate fluent-plugin-kafka-0.19.8, because bigdecimal-4.0.1 conflicts with bigdecimal (> 3.1)"

@pujitha24

Copy link
Copy Markdown
Contributor Author

Thanks for trying it, and sorry it didn't fix it for you. I can't run Docker on my machine, so I haven't reproduced the build myself. CI built the fluentd image and it passed, but that only shows the build succeeds, not that kafka activates at runtime.

My guess is that Ruby 4.0.7 already ships bigdecimal 4.0.1 as a bundled gem, and something loads it before fluent-plugin-kafka activates, so the 3.3.1 pin in the filters Gemfile never gets a say. That is only a guess. Could you tell me which image tag you built (filters or full) and the output of gem list bigdecimal inside it? That would show which versions are installed and I can look at the pin again from there.

@moyifeng2000

Copy link
Copy Markdown

It works! Building on your modifications, I further updated the Dockerfile to remove bigdecimal 4.0.1. After rebuilding the image and redeploying, logs are now being successfully collected into Kafka.

RUN rm -rf /usr/local/lib/ruby/gems/4.0.0/gems/bigdecimal-4.0.1
&& rm -rf /usr/local/lib/ruby/gems/4.0.0/specifications/bigdecimal-4.0.1.gemspec

Ruby 4.0 ships bigdecimal 4.0.1 as a bundled gem, which still conflicts
with fluent-plugin-kafka's ~> 3.1 requirement at activation time.

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fluentd v6.9.0 fails to start with Kafka output due to bigdecimal version conflict

2 participants