Skip to content

[BUG] SQL CLI integration test flaky failure due to Gradle incremental compilation race condition #5335

Closed

Description

@qianheng-aws

What is the bug?

The SQL CLI integration test workflow (sql-cli-integration-test.yml) intermittently fails with a NoSuchFileException during compilation. The failure is non-deterministic — re-running the job usually passes.

Error

Execution failed for task ':sql:protocol:compileJava'.
> Compilation failed; see the compiler output below.
  SimpleJsonResponseFormatter.java:47: error: cannot access ProfileContext
      ProfileMetric formatMetric = QueryProfiling.current().getOrCreateMetric(MetricName.FORMAT);
                                                         ^
  bad class file: .../sql-cli/remote/sql/core/build/classes/java/main/org/opensearch/sql/monitor/profile/ProfileContext.class
      unable to access file: java.nio.file.NoSuchFileException: .../ProfileContext.class

Root cause

The workflow has two steps:

  1. publishToMavenLocal — builds the SQL project under sql-cli/remote/sql/, producing .class files in the build directory
  2. ./gradlew test -PuseLocalSql=true — runs sql-cli tests, but instead of resolving SQL dependencies from Maven Local jars, the sql-cli Gradle build references the SQL source project at remote/sql/ directly and re-compiles it

When Gradle performs incremental compilation in step 2, it may delete stale .class files in core/build/classes/ before recompiling them. Meanwhile, the protocol module compilation is concurrently reading those same .class files from the classpath. This race condition causes NoSuchFileException.

Re-runs pass because Gradle daemon/cache state varies between attempts — when incremental recompilation is not triggered, there is no race.

Example failures

Suggested fix

Clean the SQL build directory after publishToMavenLocal to ensure sql-cli resolves dependencies only from Maven Local jars, not from the stale build output:

- name: Build and publish SQL modules to Maven Local
  working-directory: sql-cli/remote/sql
  run: |
    ./gradlew publishToMavenLocal -x test -x integTest
    ./gradlew clean

Activity

  1. self-assigned this
    on Apr 14, 2026
  2. added
    bug
    flaky-test
    and removed on Apr 14, 2026
  3. added
    duplicate
    on Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugduplicateflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions