Skip to content

launch_diff_antlr.sh is too slow for large projects like openjdk25, times out the 6-hour GitHub Actions limit #1107

Description

@vivek-0509

checkstyle/checkstyle now has an antlr-report.yml workflow that generates the ANTLR regression report on PR comment (checkstyle/checkstyle#19897). It works fine for the checkstyle self-test, but running it against openjdk25 hits the 6-hour GitHub Actions job limit and the report is never generated. We need openjdk runs for validating grammar changes against real Java 25 sources (e.g. checkstyle/checkstyle#20815).

Cause

The launch() function in checkstyle-tester/launch_diff_antlr.sh starts two fresh JVMs per file, one for the master jar and one for the patch jar:

for f in $(find $REPO_SOURCES_DIR -name '*.java')
do
    java -jar $TEMP_DIR/checkstyle-master-all.jar -J $f > $saveMasterFile 2>&1 &
    java -jar $TEMP_DIR/checkstyle-patch-all.jar -J $f > $savePatchFile 2>&1 &
    wait
done

For openjdk25 that is over thousands of JVM starts. Measured locally, this costs ~0.68s per file, of which the actual parsing is only ~15ms - the rest is JVM startup and classloading, repeated for every file. That extrapolates to ~10 hours for openjdk25, which is why the workflow never finishes. The per-file JVM was forced by the checkstyle CLI: -J accepts only a single file.

Proposal

Replace the loop with a single JVM per jar: a small AstBatchPrinter.java (run via the JDK source launcher, so no build step, same spirit as diff.groovy) that takes the whole file list, calls the same AstTreeStringPrinter.printJavaAndJavadocTree() API that -J uses internally, and writes the same per-file .tree files. Files are processed in parallel on a fixed-size thread pool, with a per-file catch so an unparseable file becomes error text in its own .tree like today, instead of failing the run.

Prototype results on openjdk25 (done this locallyy):

  • full report generated in 15m
  • trees for successfully parsed files are byte-identical to the current per-file approach
  • patch-diff-report-tool and the report format need no changes - output layout is identical

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions