Skip to content

fix(build): declare lombok in annotationProcessorPaths to deflake parallel-build compilation#19020

Open
wombatu-kun wants to merge 1 commit into
apache:masterfrom
wombatu-kun:fix/lombok-annotation-processor-paths
Open

fix(build): declare lombok in annotationProcessorPaths to deflake parallel-build compilation#19020
wombatu-kun wants to merge 1 commit into
apache:masterfrom
wombatu-kun:fix/lombok-annotation-processor-paths

Conversation

@wombatu-kun

@wombatu-kun wombatu-kun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

The parallel reactor build (mvn clean install -T 2) intermittently fails a module's testCompile with:

Bad service configuration file, or exception thrown while constructing Processor object:
javax.annotation.processing.Processor: Provider lombok.launch.AnnotationProcessorHider$AnnotationProcessor could not be instantiated

This is a flaky ServiceLoader race: the Lombok annotation processor is discovered from the shared compile classpath's META-INF/services file, and under a parallel (-T) build running in a single JVM that discovery/instantiation intermittently fails. It is unrelated to the code under test (it surfaced on hudi-cli while hudi-kafka-connect built fine). Seen in the test-common-and-other-modules job: https://github.com/apache/hudi/actions/runs/27601324605/job/81602759051

Summary and Changelog

Declare the annotation processor path explicitly in the parent maven-compiler-plugin configuration (<annotationProcessorPaths> with org.projectlombok:lombok:${lombok.version}) instead of relying on classpath service discovery. An explicit processor path gives each compilation a dedicated, isolated processor classloader, which removes the discovery race and also stops the compiler from scanning the whole compile classpath for processor service files.

Lombok is the only annotation processor that has any work in this build, verified by inspection: no @AutoService, Immutables, MapStruct, or log4j @Plugin annotations exist in the source and there are no custom META-INF/services/javax.annotation.processing.Processor files, so isolating Lombok does not disable any meaningful processing.

The configuration lives in the parent <pluginManagement>, so it applies to every module. The four modules that override the compiler <configuration> (hudi-common, hudi-hadoop-common, hudi-hadoop-mr, hudi-io, all only to target Java 8) still inherit annotationProcessorPaths through Maven's per-element configuration merge. This was verified with mvn help:effective-pom: their effective testCompile configuration contains both <release>8</release> and the lombok annotationProcessorPaths. No module declares its own annotationProcessorPaths, so coverage is global with this single change.

Impact

Build/CI reliability only; no product code, API, or behavior change. Reduces flaky testCompile failures caused by the processor-instantiation race under parallel builds, across all modules. Lombok processing itself is unchanged, verified by compiling a @Slf4j module (hudi-kafka-connect) cleanly under the new configuration.

Risk Level

low

Lombok is the only annotation processor with work in the repo, so making the processor path explicit is behavior-preserving for compilation, and effective-pom confirms every module (including the Java 8 ones that override the compiler config) keeps the processor path. Verified that a Lombok-using module compiles cleanly under the change. The flake is environmental and not locally reproducible, so this is the standard, recommended mitigation for the symptom rather than a locally-proven elimination.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

…allel-build compilation

Parallel reactor builds (mvn -T) intermittently fail testCompile with "Provider lombok... could not be instantiated" because the processor is discovered from the shared compile classpath via ServiceLoader. Declaring lombok explicitly in the compiler plugin's annotationProcessorPaths gives each compilation an isolated processor path, removing the race. Lombok is the only annotation processor with work in the build, so no other processing is affected.
@wombatu-kun wombatu-kun marked this pull request as draft June 16, 2026 07:54
@wombatu-kun wombatu-kun marked this pull request as ready for review June 16, 2026 07:55
@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@hudi-agent hudi-agent 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.

🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for the contribution! This PR declares Lombok explicitly in annotationProcessorPaths in the parent maven-compiler-plugin config to fix a flaky ServiceLoader race during parallel reactor builds. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.

cc @yihua

@github-actions github-actions Bot added the size:S PR with lines of changes in (10, 100] label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants