Skip to content

[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars - #3884

Open
Jackeyzhe wants to merge 1 commit into
apache:mainfrom
Jackeyzhe:fix-3553-jackson-uber-jar-leak
Open

[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars#3884
Jackeyzhe wants to merge 1 commit into
apache:mainfrom
Jackeyzhe:fix-3553-jackson-uber-jar-leak

Conversation

@Jackeyzhe

Copy link
Copy Markdown
Contributor

Summary

fluss-shaded-jackson contains unshaded Multi-Release JAR (MRJ) entries under
META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/ (and sibling
parser dirs). The Maven Shade Plugin only relocates base-path classes, not MRJ
entries. These leak into uber-jars (fluss-client, fluss-flink-*) and can
shadow downstream apps' jackson-core 2.16+, causing NoSuchMethodError: JsonToken._updateToken.

Root Cause

The shade plugin's relocation (<relocation>) only transforms classes at their
base path (com/fasterxml/jackson/...). Multi-Release JAR entries stored under
META-INF/versions/<java-version>/com/fasterxml/jackson/... are not relocated
and remain at their original package path. When these entries are packaged into
uber-jars, they can win the class-loading race against the consumer's own
jackson-core dependency.

Fix

Add <exclude>META-INF/versions/**/com/fasterxml/**</exclude> to the root
pom.xml global shade filter (<artifact>*</artifact>). This cascades to ALL
modules via combine.children="append".

The base FastDoubleParser implementation (at the relocated path) is sufficient
for all Java versions; the MRJ entries are only performance optimizations for
specific JDK versions.

Test Plan

  • Before fix: 5 uber-jars (fluss-client + fluss-flink-1.18/1.19/1.20/2.2/tiering)
    contain unshaded jackson MRJ entries
  • After fix: 0 unshaded jackson entries in all 5 uber-jars
  • ./mvnw -pl fluss-common test passes (267 tests, 0 failures)
  • ./mvnw spotless:check passes
  • git diff --check clean

Files Changed

  • pom.xml (+11 lines: 1 exclude rule in global shade filter)

🤖 AI-assisted changes - reviewed by human developer

Closes #3553

Exclude unshaded Multi-Release JAR (MRJ) entries from fluss-shaded-jackson
via root pom.xml global shade filter. MRJ entries under
META-INF/versions/*/com/fasterxml/jackson/ are not relocated by the
shade plugin and leak into uber-jars, shadowing downstream apps'
jackson-core (NoSuchMethodError: JsonToken._updateToken).

🤖 AI-assisted changes - reviewed by human developer

Closes apache#3553
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.

[fluss-client][ fluss-flink-*] Uber-jars leak com.fasterxml.jackson.core alongside the shaded copy

1 participant