fix: stop the recurring CodeQL OutOfMemoryError - #1859
Merged
Conversation
Neither org.gradle.jvmargs nor kotlin.daemon.jvmargs was set, so the Gradle daemon ran with its 512m default and the Kotlin daemon inherited that -Xmx. That is not enough for the Kotlin compiler to initialise, even though this repository holds only ~450 lines of Kotlin. The regular CI never noticed: setup-gradle restores ~/.gradle, so with org.gradle.caching=true the compile tasks came from the build cache and never ran. CodeQL builds uncached and hit the ceiling instead, failing :quicktype-plugin:compileTestKotlin with OutOfMemoryError after burning well over an hour in GC thrashing. Raising the heap in gradle.properties rather than in one workflow keeps it true for every caller -- CI on a cache miss and local builds included. Claude-Session: https://claude.ai/code/session_01KoRfB2M6kb2Ci8npcANvUF
Autobuild picked the JDK, the tasks and the Gradle flags on its own, and its failure surfaced as "We were unable to automatically build your code" rather than as the compiler error underneath. Spelling the build out removes that indirection and pins the parts that matter. --no-build-cache is the load-bearing flag: org.gradle.caching=true would let compile tasks come from the cache, no compiler would run, and the tracer would produce an empty database behind a green check. GitHub names Gradle caching as a cause of "No source code was seen during the build". The task list stays what autobuild used, so the scanned scope does not change. The timeout drops from 360 to 60 minutes; a healthy run takes seven, and the failing one was allowed to spin for eighty. Claude-Session: https://claude.ai/code/session_01KoRfB2M6kb2Ci8npcANvUF
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.
Problem
Analyze (java-kotlin)fails intermittently, most recently onmaininrun 33512523694
after 1h20m, and on 2026-08-31 in
run 33368076297.
Same task both times:
Since the job is a required status check, every occurrence blocks merges.
Root cause
Neither
org.gradle.jvmargsnorkotlin.daemon.jvmargswas set anywhere.Gradle's daemon therefore defaulted to
-Xmx512m, and the Kotlin daemoninherits
-Xmxfrom it.That is not enough for the Kotlin compiler to initialise, even for the ~450
lines of Kotlin in this repository.
It looked flaky because it is really a cache-hit/cache-miss difference: the
regular CI restores
~/.gradleviasetup-gradle, so withorg.gradle.caching=truethe compile tasks come from the build cache and neverrun. CodeQL builds uncached and hits the ceiling every time.
Changes
gradle.properties(root andexamples/) — setorg.gradle.jvmargsandkotlin.daemon.jvmargs. Fixing it here rather than in one workflow keeps ittrue for CI on a cache miss and for local builds too.
codeql.yml—build-mode: autobuild→manualwith an explicit./gradlew testClasses --no-daemon --no-build-cache -Sand a pinned JDK 17(the project toolchain;
settings.gradlehas no toolchain resolver, so Gradlecannot provision one itself).
--no-build-cacheis deliberate and load-bearing: a compile task served fromthe cache invokes no compiler, the tracer sees nothing, and CodeQL would
report a green run over an empty database. GitHub names Gradle caching as
a cause of "No source code was seen during the build".
For the same reason
setup-gradleis intentionally not used here.The task list is what autobuild already compiled, so the scanned scope is
unchanged.
Timeout for
java-kotlinfrom 360 to 60 minutes. A healthy run takes ~7.How to verify
Beyond the checks going green, the analysis must not come back empty:
A healthy analysis on
mainreportsrules_count: 240/results_count: 54.The failed run uploaded
0/0. If this PR's analysis does not report ~240rules, the build mode is misconfigured and this should not be merged.
Locally
./gradlew assembleand./gradlew checkboth pass with the newsettings.