Skip to content

[build] fluss-filesystems uber-jars ship unshaded jackson + guava that can shadow downstream dependencies #4116

Description

@Jackeyzhe

Search before asking

  • I searched in the issues and found nothing similar.

Fluss version

main (development)

Please describe the bug 🐞

While fixing the same class of shading leak in fluss-fs-s3 (#4073, follow-up to
#3884), I checked the rest of the fluss-filesystems family. I rebuilt every fs
plugin from current main and inspected the produced shaded uber-jar. All
seven ship unshaded com.fasterxml (jackson) and com.google (guava)
that
will shadow any downstream application's own jackson / guava on the classpath,
causing NoSuchMethodError / NoClassDefFoundError / silent version skew — the
same failure mode reported in #3884.

Measured leak (top-level unshaded entries in the shaded uber-jar)

Plugin jackson (com/fasterxml) guava (com/google) MRJ escaped* notes
fluss-fs-hdfs 1,073 2,731 25 baseline
fluss-fs-s3 1,093 2,042 25 leaks on main; fix proposed in open PR #4073 (not yet merged)
fluss-fs-oss 1,073 2,230 25
fluss-fs-cos 1,073 2,246 25
fluss-fs-azure 1,073 2,042 25
fluss-fs-obs 1,161 2,042 25
fluss-fs-gs 1,073 7,351 25 worst: ~3.6× the guava of the others, and no relocated copy at all (see below)

* MRJ = META-INF/versions/N/com/fasterxml/jackson/core/io/doubleparser/**
entries that escape relocation — the exact #3884 bug class, present in all 7.

fluss-fs-hadoop-shaded itself is fine: it relocates
com.fasterxmlorg.apache.fluss.fs.shaded.hadoop3.com.fasterxml and ships
hadoop's guava as org.apache.hadoop.thirdparty.com.google (already
third-partied by hadoop, not leaked). The leak is in the consumer fs plugins.

Root cause (confirmed from pom inspection)

Each fs plugin's own maven-shade-plugin config only relocates
org.apache.commonsorg.apache.fluss.shaded.org.apache.commons. It does
not relocate com.fasterxml or com.google. Two consequences:

  1. hdfs / s3 / oss / cos / azure / obs pull jackson + guava from their direct
    deps (hadoop-common, aws-sdk, azure/gcs libs). Those land unshaded at the jar
    top level → leak. (These modules also bundle a second, correctly-relocated
    jackson copy inherited from fluss-fs-hadoop-shaded, which is why a relocated
    org/apache/fluss/fs/shaded/hadoop3/com/fasterxml copy also appears — but the
    unshaded copy is what breaks downstream apps.)
  2. fluss-fs-gs is the worst offender: its shade config relocates nothing
    (not even org.apache.commons), and it does not depend on
    fluss-fs-hadoop-shaded, so it has no relocated copy to lean on. The Google
    Cloud Storage libs drag in a huge com.google tree (guava + protobuf + gax),
    all unshaded → 7,351 leaked guava entries.

The fix proposed in #4073 (relocate com.fasterxml + com.google + add the MRJ
exclusion filter) is exactly what the other six need. Note: on main, s3 still
leaks like the rest (1,093 jackson + 2,042 guava) — #4073 is an open PR, not yet
merged
, so s3's fix only lands when that PR merges. Until then, s3 sits in the same
"to-fix" bucket as the other six in this issue; once #4073 merges, s3 drops out and
the remaining six (gs worst) become the work.

Proposed fix

Two viable strategies:

Per-plugin verification: 0 unshaded com/fasterxml and com/google entries
in the produced uber-jar (base path + MRJ), with constant-pool references
rewritten to the shaded path, and hadoop's own
org.apache.hadoop.thirdparty.com.google namespace left untouched.

Status

  • fluss-fs-s3: verified leaked on main (1,093 jackson + 2,042 guava); fix proposed in open PR [build] Relocate shaded jackson and other internal deps in fluss-fs-s3 #4073 (not merged yet)
  • fluss-fs-hdfs: verified leaked (1,073 + 2,731) ← natural starting point
  • fluss-fs-oss / cos / azure / obs: verified leaked (~1,073 jackson + ~2,000–2,250 guava)
  • fluss-fs-gs: verified leaked, worst (1,073 jackson + 7,351 guava)

Happy to drive this (centralized parent-pom fix, or per-plugin starting with gs)
once #4073 lands.

References

Solution

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions