Skip to content

HDDS-15560. Introduce inter-procedural static analysis fbinfer to Ozone CI - #10940

Draft
ivandika3 wants to merge 19 commits into
apache:masterfrom
ivandika3:HDDS-15560
Draft

HDDS-15560. Introduce inter-procedural static analysis fbinfer to Ozone CI#10940
ivandika3 wants to merge 19 commits into
apache:masterfrom
ivandika3:HDDS-15560

Conversation

@ivandika3

@ivandika3 ivandika3 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

(Currently put to draft as a POC and to prevent unnecessary CI runs and handle TODO like suppressing tests, try to do selective checks, etc)

We can explore adding fbinfer ( https://fbinfer.com/ ) to the CI to catch even more bugs. It's been used in other ASF projects like Apache Arrow to run inter-procedural static analysis that can catch more complex bugs (ARROW-1626). CodeRabbit also have fbinfer as one of its tool (https://docs.coderabbit.ai/tools/fbinfer)

This is based on the observation that unlike language like Golang ("go test -race"), Java currently does not have a way to detect data race. fbinfer will allow us to use RacerD (https://fbinfer.com/docs/checker-racerd/) which should allow us to detect data race.

Hopefully with this, we can find more tricky bugs and gain confidence when implementing patches.

Also this being a static analyzer means it is not invasive.

(Generated By: DeepSeek V4 Pro)

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15560

How was this patch tested?

CI.

Infer runs

- Add dev-support/checks/install/infer.sh to download Infer v1.3.0
- Add dev-support/checks/infer.sh check script (#checks:basic)
- Add .inferconfig to exclude generated and test sources from analysis
- Add infer-annotation dependency (provided scope) to ozone-manager and server-scm
- Annotate 7 thread-safe classes with @threadsafe:
  OzoneManager, SCMStateMachine, OzoneManagerLock, SCMNodeManager,
  SnapshotChainManager, OzoneDelegationTokenSecretManager, SCMSafeModeManager
- Add .github/workflows/infer.yml (push-only, non-blocking, uploads artifacts)
- Add .inferconfig to RAT exclusions

Generated-by: Codex (GPT 5.5)
…st infer.sh

- Change infer-annotation from provided to compile scope so downstream
  modules (ozone-recon) can resolve @threadsafe annotations transitively
- Remove 'clean' from infer.sh mvn command to avoid deleting target/infer/
- Recreate REPORT_DIR after infer run as a defensive measure
- Restore ozonefs pom.xml files after infer run via git checkout, since
  Infer's Maven capture can corrupt profile-governed modules

Generated-by: Codex (GPT 5.5)
- Move infer-annotation dependency to correct alphabetical position
  (com.facebook before com.fasterxml) in server-scm and ozone-manager pom.xml
- Reset infer exit code to 0 when infer-out/ exists, since epilogue
  pom.xml restoration errors are non-fatal and the analysis completes

Generated-by: Codex (GPT 5.5)
- infer.sh: truncate REPORT_FILE in no-findings case so _post_process.sh exits 0.
  Remove ERROR_PATTERN to avoid catching infer epilogue pom.xml restoration noise.
- selective_ci_checks.bats: add 'infer' to expected basic-checks in 4 tests that
  hit set_outputs_run_everything_and_exit (which discovers all #checks: scripts).
- pom.xml: change infer-annotation from compile to provided scope.
  @threadsafe is RetentionPolicy.CLASS, not needed at runtime.
…ure so test-jars are available for downstream modules
…s transitively visible to downstream modules
@ivandika3 ivandika3 added test build Pull request that modifies the build process labels Aug 4, 2026
@ivandika3 ivandika3 self-assigned this Aug 4, 2026
… and selective checks

- Add paths filter to infer.yml so the standalone workflow only triggers
  when Java sources, POMs, .inferconfig, or infer scripts change.
- Add check_needs_infer to selective_ci_checks.sh so the basic matrix
  only runs infer when Java sources or infer config/scripts change.
- Add .inferconfig to get_count_misc_files so it doesn't force a full
  CI run on unrelated changes.
- Add @threadsafe annotation to ContainerData to enable inter-procedural
  thread-safety analysis by Infer's RacerD checker.
- Add infer-annotation dependency to hdds-container-service module with
  transitive exclusions (jsr305, kotlin-annotations-jvm) consistent with
  hdds-server-scm and ozone-manager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Pull request that modifies the build process test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant