HDDS-15560. Introduce inter-procedural static analysis fbinfer to Ozone CI - #10940
Draft
ivandika3 wants to merge 19 commits into
Draft
HDDS-15560. Introduce inter-procedural static analysis fbinfer to Ozone CI#10940ivandika3 wants to merge 19 commits into
ivandika3 wants to merge 19 commits into
Conversation
- 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.
…fy from failing on root pom.xml
…readsafe is visible transitively
…ure so test-jars are available for downstream modules
…ozone-manager POMs
… artifact, exit 0 on findings
…om ordering; restore poms before infer run
…s transitively visible to downstream modules
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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