Skip to content

fix: cargo clean before release build to avoid stale native libs#4257

Open
andygrove wants to merge 1 commit intoapache:mainfrom
andygrove:fix-release-cargo-clean
Open

fix: cargo clean before release build to avoid stale native libs#4257
andygrove wants to merge 1 commit intoapache:mainfrom
andygrove:fix-release-cargo-clean

Conversation

@andygrove
Copy link
Copy Markdown
Member

@andygrove andygrove commented May 7, 2026

Which issue does this PR close?

Closes #2232

Rationale for this change

Issue #2232 reported that the 0.9.1 jars were nearly twice the size of 0.9.0. Investigation showed that a stale org/apache/comet/darwin/aarch64/libcomet.dylib (227MB uncompressed) was bundled into the release jar, even though the release script had HAS_MACOS_SDK=false (the default) and was not asked to ship a darwin/aarch64 binary.

Root cause: common/pom.xml declares two unconditional resource entries that always bundle libcomet.dylib from native/target/{x86_64,aarch64}-apple-darwin/release whenever those files exist on disk. The release script runs ./mvnw clean, but Maven only cleans common/target, not Cargo's native/target. If the release manager has previously run make release-linux (or otherwise cross-compiled to apple-darwin) in their working tree, those stale dylibs silently leak into the release jars produced by build-release-comet.sh.

What changes are included in this PR?

  • dev/release/build-release-comet.sh: run cargo clean after mvnw clean so stale cross-compiled artifacts are removed before the release build.
  • docs/source/contributor-guide/release_process.md: add a note explaining the leakage risk and recommending release managers run from a fresh clone as a defense-in-depth measure.

How are these changes tested?

Manual review only. The release script is exercised by release managers ahead of each release; no automated test exists for this code path.

The common/pom.xml resource configuration unconditionally bundles
libcomet.dylib from native/target/{x86_64,aarch64}-apple-darwin/release
into the common jar. Maven's clean does not touch Cargo's native/target,
so stale dylibs from a prior local cross-compile on the release manager's
workstation could silently leak into release jars.

Run cargo clean in build-release-comet.sh before the docker builds, and
document the issue in the release process guide.

Refs apache#2232
Copy link
Copy Markdown
Contributor

@mbutrovich mbutrovich left a comment

Choose a reason for hiding this comment

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

Thanks @andygrove!

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.

Comet 0.9.1 jars are nearly 2x larger than 0.9.0 jars

2 participants