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-full-sourcesfrom
rombirli/semsitter-pvf
Open

rombirli wants to merge 3 commits into
rombirli/semsitter-full-sourcesfrom
rombirli/semsitter-pvf

Conversation

@rombirli

@rombirli rombirli commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part 18 of 18 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.

$\color{red}{\textbf{CONTRACT WITH SONARQUBE CLOUD: sonar.java.internal.semsitter.enabled}}$

SonarQube Cloud must send this context property to turn the SemSitter frontend on. Its name is defined once, in SemSitterFlag.ENABLED_PROPERTY. Renaming it requires the same change in SonarQube Cloud.

  • The provider is told the product running the analysis (JParserProvider.configure(Configuration, SonarRuntime), called by JavaSensor)
  • A udg-java-server for Linux amd64 and one for Linux arm64 are bundled, and extracted only during PVF (sensor.context.key is sonar.java.context) or on SonarQube Cloud (runtime edition SONARCLOUD, which is what the analysis-as-a-service reports). Other analyses, including ruling, stay on ECJ
  • Where the bundled server applies, the frontend is on whatever the flag says. SemSitterFlag.DEFAULT is unchanged (off)
  • No ECJ fallback anywhere (the base PR makes the analysis fail when the frontend is asked for and cannot be used). Here a host that is not Linux amd64 or arm64, or a server that cannot be extracted, fails the analysis too
flowchart TD
  R[configure with runtime] --> X{executable configured?}
  X -->|yes| FL{flag on?}
  FL -->|yes| SS[SemSitterParser with that server]
  FL -->|no| ECJ[ECJ]
  X -->|no| G{PVF or SONARCLOUD edition?}
  G -->|no| FL2{flag on?}
  FL2 -->|yes| F[analysis fails: no executable]
  FL2 -->|no| ECJ
  G -->|yes| H{host Linux amd64 or arm64?}
  H -->|no or cannot extract| F2[analysis fails]
  H -->|yes| SB[SemSitterParser with the bundled server]
Loading

Check it ran on SemSitter: the analyzer logs The Java analyzer will use the SemSitter frontend with the bundled server <path>. once per analysis. The A3S benchmark on dev22 did not get SemSitter because the previous gate only knew PVF and x86_64, and A3S runs on arm64.

The bundled binaries are the linux-x86_64-musl and linux-aarch64-musl release builds of a semsitter branch combining semsitter#5821 and semsitter#5018 on master (run 46429698527).

The server is extracted to ~/.sonar/semsitter, or to java.io.tmpdir when the home directory is missing or not writable (the case in the analysis-as-a-service, where user.home does not exist).

sonar.java.internal.semsitter.fullSources (from the previous PR) is accepted here whenever the bundled server applies, since the bundled server turns the frontend on. Where there is no bundled server and the flag is off, it still fails the analysis.


Summary by Gitar

  • Bundled server:
    • Added BundledServer shipping Linux amd64 and arm64 SemSitter servers, extracted for PVF or SonarQube Cloud
    • Fails analysis on unsupported hosts or failed extraction, with no ECJ fallback
  • Provider runtime:
    • SemSitterParserProvider and JParserProviders receive the SonarRuntime via new configure overload
    • Accepts sonar.java.internal.semsitter.fullSources when the bundled server applies
  • Disabled tests:
    • JavaSensorTest and SpringContextModelSensorTest disabled, since the default runtime uses the Linux-only server
  • Build:
    • Raised sonar-java-plugin jar max size to 50000000 bytes to fit bundled binaries

This will update automatically on new commits.

@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 3104146 to 4e971bf Compare November 30, 2026 13:44
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 4e971bf to 6a2208f Compare November 30, 2026 15:47
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch 2 times, most recently from 281a35c to 2fe9d92 Compare December 1, 2026 11:06
@rombirli
rombirli removed this pull request from stack #6589 December 1, 2026 11:07
@rombirli
rombirli changed the base branch from rombirli/semsitter-provider-flag to rombirli/semsitter-full-sources December 1, 2026 11:07
@rombirli
rombirli added this pull request to stack #6607 December 1, 2026 11:08
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 2fe9d92 to 378df0b Compare December 1, 2026 11:23
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 378df0b to 9338562 Compare December 1, 2026 11:24
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 9338562 to 58341e8 Compare December 2, 2026 13:54
@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from 58341e8 to c63cbae Compare December 2, 2026 14:21
@rombirli

rombirli commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/pvf

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@rombirli ❌ Your /pvf command was not dispatched. See the failed run.

No candidate-version artifact for c63cbae; wait for Build to finish

@rombirli
rombirli force-pushed the rombirli/semsitter-pvf branch from c63cbae to 381a006 Compare December 2, 2026 14:47
@rombirli

rombirli commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/pvf

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 13580 new · 🗑️ 6397 lost issues
View dashboard

@sonarqube-next

sonarqube-next Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@gitar-bot

gitar-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 7 closed / 7 findings

Automatically enabling bundled SemSitter for SonarQube Cloud and PVF changes parsing across those analyses and could alter results or fail runs on unsupported hosts.

Bundles Linux amd64 and arm64 SemSitter servers and enables the SemSitter frontend for PVF and SonarQube Cloud analyses, failing rather than falling back to ECJ when the server cannot be used. Resolved the stale description about the flag and the shared /tmp re-copy on each configure, and corrected the flag-failure log message. No open issues remain.

✅ 7 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: Bug: SONARCLOUD edition gate fails every non-Linux SonarQube Cloud scan

📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/BundledServer.java:31-38 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/BundledServer.java:49-63 📄 java-frontend-semsitter/src/main/java/org/sonar/java/semsitter/SemSitterParserProvider.java:79-84
BundledServer.extract picks the bundled server whenever runtime.getEdition() == SonarEdition.SONARCLOUD. The scanner reports that edition for every analysis sent to SonarQube Cloud, including customer CI scans on Windows, macOS or other hosts, not only for the analysis-as-a-service. On those hosts resourceFor throws IllegalStateException, and start lets it through, so the Java analysis fails. On Linux hosts, every Cloud analysis switches to SemSitter even when sonar.java.internal.semsitter.enabled is false. That goes against the stated contract that SemSitter enablement is property-only, and against the class javadoc's claim that the server is used only on the runners that have none installed. Since this is a DO NOT MERGE PR, the impact is limited, but the gate does not match what the description says it does. To fix it, restrict the gate to A3S using a signal only it sends (for example a context property or sonarComponents.isAutoScan()), or let non-Linux Cloud hosts keep ECJ when no flag asks for SemSitter.

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.

...and 2 more closed from earlier reviews

Verification Rules 1/1 met Knowledge 🔎 1 Repos 4 inspected · PRs 4 inspected

Functional validation No results

Rules 1 passed 1 not applicable

✅ Release secrets usage

Knowledge 🔎 1 informed a finding

🔎 SemSitter enablement uses a context property informed a finding, dismissed -> SONARCLOUD edition gate fails every non-Linux SonarQube Cloud scan

Broader impact Repos 4 inspected PRs 4 inspected
Cross-repo 4 repositories inspected 0 open impacts

SonarSource/sonar-java-symbolic-execution Inspected
SonarSource/sonar-iac Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-language-server Inspected

Cross-PR 4 PRs inspected 0 open impacts

PR 6583: JAVA-7406 Offer the SemSitter frontend behind a flag Inspected
PR 6567: JAVA-7393 Let the Java frontend be swapped through a parser provider Inspected
PR 6568: JAVA-7394 Add the SemSitter frontend module and its protocol client Inspected
PR 6553: SONARJAVA-7339 Parse with the SemSitter translator behind the feature flag Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

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

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