Work around scaladoc JIT NPE on JDK 25#160
Merged
Merged
Conversation
The publish job's scaladoc crashes with a SignatureBuilder NPE (scala/scala3#24183): on JDK 25 the C2 JIT miscompiles a combinator so content() returns null once the method is compiled, after several doc runs warm it up in one JVM. It is not a concurrency race, so the doc-task serialization added earlier had no effect; drop it and exclude the offending scaladoc class from JIT via .jvmopts instead. Fixed upstream in Scala 3.9.0 (scala/scala3#25779).
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.
Root cause
The
publishjob (and, since #159 addedopentelemetry/doc, thedocsjob) fails with a scaladoc crash:This is scala/scala3#24183: on JDK 25 the C2 JIT miscompiles a combinator in scaladoc's
SignatureBuilder, socontent()returns null once that method gets JIT-compiled. That only happens after the method is warmed up by several doc runs in one JVM, which is why it hit a random cell and only in the many-cellci-release/docAllruns, not standalone. Started when CI moved to Temurin 25. Fixed upstream in Scala 3.9.0 (scala/scala3#25779).Confirmed locally: with C2 disabled (
-XX:TieredStopAtLevel=1) or the offending class excluded from JIT,docAllgoes from reliably crashing to 0 crashes.Changes
.jvmopts: excludedotty.tools.scaladoc.translators.SignatureBuilderfrom JIT. sbt reads.jvmoptson every invocation, so this covers both thedocsandpublishjobs (and localdoc/publishLocal) with C2 left on everywhere else. Harmless where scaladoc isn't loaded.build.sbt: remove the doc-task serialization from Serialize scaladoc during publish and fix opentelemetry doc links #159 (scaladocTag,concurrentRestrictions, theCompile / doctag). It was based on a wrong concurrency hypothesis and had no effect — the crash reproduces with doc tasks run strictly serially.Verification
sbt docAllon a clean fresh JVM: 0 crashes across two trials (previously ~reliably crashed), and the docs-gate warning grep passes.RuntimeMXBeanthat the.jvmoptsflag actually reaches the sbt JVM.scalafmtSbtCheckpasses.