Skip to content

JAVA-7407 DO NOT MERGE Run PVF with the SemSitter frontend - #6584

Open
rombirli wants to merge 3 commits into
rombirli/semsitter-provider-flagfrom
rombirli/semsitter-pvf
Open

rombirli wants to merge 3 commits into
rombirli/semsitter-provider-flagfrom
rombirli/semsitter-pvf

Conversation

@rombirli

@rombirli rombirli commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part 17 of 17 of JAVA-7392. Ticket: JAVA-7407.

DO NOT MERGE

Throwaway PR to run PVF with the SemSitter frontend on, on top of the whole stack.

  • The flag defaults to on, and the bundled server never asks it, so PVF always runs SemSitter
  • A Linux udg-java-server is bundled and extracted only during PVF (other Linux analyses, including ruling, stay on ECJ)
  • No ECJ fallback anywhere: PVF compares two independent frontends
flowchart LR
  PVF[PVF analysis on Linux] --> B[BundledServer extracts udg-java-server]
  B -->|cannot extract| F
  B --> S[SemSitterParser]
  S -->|unsupported file| PE[parse error, counted as such]
  S -->|server cannot start| F[analysis fails]
Loading

The bundled binary is the linux-x86_64-musl release build of semsitter#5821 rebased on master (commit 81a1ef9b2, run 45653137453).

@rombirli
rombirli added this pull request to stack #6570 November 25, 2026 11:48
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch 2 times, most recently from 2be191e to 4acb342 Compare November 25, 2026 12:03
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 14486 new · 🗑️ 31182 lost issues
View dashboard

Projects with unexpected PVF results:

  • netflix-conductor

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch 2 times, most recently from 14aad2f to 6bccb82 Compare November 25, 2026 13:41
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch 2 times, most recently from 43c17ec to e935883 Compare November 25, 2026 14:55
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from e935883 to 9b032e2 Compare November 25, 2026 15:32
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 9b032e2 to afc6aad Compare November 25, 2026 16:31
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 14969 new · 🗑️ 10182 lost issues
View dashboard

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from afc6aad to 33df63c Compare November 25, 2026 17:16
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 14967 new · 🗑️ 10182 lost issues
View dashboard

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 2ba0a4d to 156952b Compare November 25, 2026 18:39
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

⚠️ Performance Validation finished without publishing a dashboard. See run logs.

@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 14961 new · 🗑️ 10182 lost issues
View dashboard

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 156952b to 650ba2b Compare November 25, 2026 20:45
@rombirli
rombirli removed this pull request from stack #6570 November 25, 2026 20:47
@rombirli
rombirli added this pull request to stack #6589 November 25, 2026 20:48
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 650ba2b to 8fa2a57 Compare November 25, 2026 20:57
@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 8fa2a57 to 89dfa66 Compare November 25, 2026 21:26
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 89dfa66 to 822d2c4 Compare November 25, 2026 21:28
@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

⚠️ Performance Validation finished without publishing a dashboard. See run logs.

@rombirli

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 13465 new · 🗑️ 6434 lost issues
View dashboard

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch 2 times, most recently from 82d613d to c0620b9 Compare November 27, 2026 08:29
…that frontend

The performance validation runners have no SemSitter executable. This build ships
the protocol 2 Linux server and turns the frontend on when no path is configured.
Other Linux analyses, including ruling, stay on the default frontend.
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from c0620b9 to f7239ef Compare November 27, 2026 09:24
@gitar-bot

gitar-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
CI failed: The ruling notification job failed with 'No artifacts were downloaded' because the upstream ruling QA result was cancelled, so the actual_* artifacts were likely never produced. The analyzer marks this as unrelated to the PR, since the cause of the cancellation is not shown in the log.

Overview

The ruling notification job failed with 'No artifacts were downloaded' because the upstream ruling QA result was cancelled, so the actual_* artifacts were likely never produced. The analyzer marks this as unrelated to the PR, since the cause of the cancellation is not shown in the log.

Failures

Ruling notification failed: no actual_* artifacts downloaded after upstream ruling QA was cancelled

  • Type: infrastructure
  • Affected jobs: 140420110245
  • Related to change: no
  • Confidence: high
  • Root cause: The log reports Ruling QA result: cancelled, then the ruling-update action fails during artifact sync with No artifacts were downloaded. The cancellation explains the missing artifacts, though the log does not show why ruling QA was cancelled. The PR changes SemSitter Java parsing and server packaging; no supplied evidence connects them to this workflow artifact-collection failure.
  • Suggested fix: Investigate why the ruling QA job was cancelled. Update the notification workflow/action to handle a cancelled upstream job or absent artifacts without failing artifact sync; if artifacts are required, ensure the ruling jobs upload them on failure where possible.

Summary

  • Change-related failures: 0
  • Infrastructure/flaky failures: 1
  • Recommended action: Investigate why the ruling QA job was cancelled. Update the notification workflow/action to handle a cancelled upstream job or absent artifacts without failing artifact sync; if artifacts are required, ensure the ruling jobs upload them on failure where possible.
Code Review ✅ Approved 🟡 Medium risk 5 closed / 5 findings

Defaulting SemSitter on and forcing it for PVF changes Java parsing; unsupported inputs or server failures could alter results or fail analyses.

Turns the SemSitter frontend flag on by default and bundles a Linux udg-java-server that is extracted only during PVF runs, so PVF compares SemSitter against itself with no ECJ fallback. Resolved the stale description about the flag, the shared /tmp re-copy on every configure, and the flag-failure log that named ECJ while SemSitter was enabled. Two items are closed without a fix in this PR: a new 20 MB server copy per JVM in ~/.sonar/semsitter, and silent fallback to ECJ when bundled-server extraction fails. No open issues remain.

✅ 5 closed
✅ Quality: Description says the flag is no longer asked, but it still is

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:92 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:98-110 📄 java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:139-146
The PR description says "The provider no longer asks for the flag: a known executable is enough". The diff only changes FLAG_DEFAULT to true. isFlagOn still connects to LaunchDarkly whenever a client id is set, either through sonar.java.semsitter.launchDarkly.clientSideId or SONAR_JAVA_LAUNCHDARKLY_CLIENT_ID. A flag that is off for the project still keeps ECJ, and the unchanged test flag_off_keeps_the_default_frontend still checks this.

If the PVF environment provides a client id and the flag is off for the benchmark projects, PVF silently runs on ECJ. That defeats the purpose of this PR.

Fix: skip isFlagOn when an executable is known, or update the description.

✅ Performance: Bundled server is re-copied to a shared /tmp path on every configure

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/BundledServer.java:40-54 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:84-86
JavaSensor calls JParserProviders.configure(context.config()) once per sensor run, so once per module. Each call goes through BundledServer.extract(), which copies the ~20 MB resource to ${java.io.tmpdir}/udg-java-server-…part again and renames it. The copy happens inside the analysis time that PVF measures, so every module of a multi-module benchmark project pays for it.

The .part and destination names are also fixed and shared. If two analyses run on the same host at once, one JVM's Files.copy(..., REPLACE_EXISTING) can unlink and recreate the .part while the other JVM is still writing to it. The second JVM then moves a half-written file into place, and that truncated binary gets executed.

Fix: extract once per JVM (memoize the result) to a file with a unique name, for example Files.createTempFile.

✅ Quality: Flag-failure log now says ECJ is used when SemSitter is enabled

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:49 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:106-108 📄 java-frontend-semsitter/src/test/java/org/sonar/java/semsitter/SemSitterParserProviderTest.java:115-121
With FLAG_DEFAULT = true, a LaunchDarkly failure now returns true and turns the SemSitter frontend on. The warning still says "the default frontend is used", so the logs describe the opposite of what happens. The test name without_property_nor_client_id_the_default_frontend_stays is also out of date: it now asserts that the provider is enabled.

Fix: change the log to something like "the flag default (enabled={}) is used" and pass FLAG_DEFAULT.

Closed: Performance: Each JVM leaves a new 20 MB server copy in ~/.sonar/semsitter

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/BundledServer.java:58-68
copyOnce now calls Files.createTempFile(directory, RESOURCE, "") under ~/.sonar/semsitter. That gives every analysis JVM a new, randomly named file. Nothing ever deletes these files: there is no deleteOnExit, no cleanup of older copies, and none on the failure paths when Files.copy throws or setExecutable returns false. The bundled resource is about 20 MB (udg-java-server-x86_64-unknown-linux-musl is 20,159,824 bytes), so each PVF analysis on a runner with a persistent home directory adds roughly 20 MB that is never reclaimed. Fix: call destination.toFile().deleteOnExit() right after creating the file, and delete the file in the failure branches.

Closed: Edge Case: Failed bundled-server extraction silently drops PVF back to ECJ

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:85-90 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/BundledServer.java:50-64
During PVF, configure takes the bundled server through configuredServer.or(bundledServer). If BundledServer.copyOnce cannot copy it (resource missing, ~/.sonar not writable, setExecutable failing, any IOException), it returns Optional.empty() and logs nothing. server is then null, configure returns with enabled = false, and the analysis runs on ECJ, also without a log line. That goes against the PR's stated contract ("No ECJ fallback anywhere", "server cannot start → analysis fails"). A broken extraction would yield an ECJ-vs-ECJ PVF run that looks valid. To fix it, log a warning, or better, fail when the PVF context is detected but extraction fails, so a bad run can't pass for a SemSitter comparison.

Verification PRs 4 inspected

Functional validation No results

Rules 5 not applicable

Broader impact PRs 4 inspected
Cross-PR 4 PRs inspected 0 open impacts

PR 6583: JAVA-7406 Offer the SemSitter frontend behind a flag Inspected
PR 6582: JAVA-7405 Read the SemSitter frontend flag from LaunchDarkly Inspected
PR 6568: JAVA-7394 Add the SemSitter frontend module and its protocol client Inspected
PR 6569: JAVA-7395 Run a SemSitter parsing session Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
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.

1 participant