Skip to content

build: enable build cache and parallel execution, and harden async timing tests#103

Merged
OmarAlJarrah merged 3 commits into
mainfrom
build/enable-cache-parallel-and-test-robustness
Jun 16, 2026
Merged

build: enable build cache and parallel execution, and harden async timing tests#103
OmarAlJarrah merged 3 commits into
mainfrom
build/enable-cache-parallel-and-test-robustness

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

Enables org.gradle.caching=true and org.gradle.parallel=true, and hardens the async test suites so parallel execution is stable.

Why the test changes ship with the flag

Parallel project execution runs modules' test tasks concurrently, which oversubscribes CPU cores. The four async test modules had ~20 tight wall-clock failsafe deadlines — future.get(2, TimeUnit.SECONDS), withTimeout(2000), Netty await(2, TimeUnit.SECONDS), Reactor block(ofSeconds(2)), etc. — that exist only to keep a test from hanging on success. They assume near-dedicated cores and intermittently time out under the contention parallel execution creates (and would also flake on slow shared CI runners, independent of parallel). So enabling parallel requires hardening them, and the two changes belong together.

Each such failsafe is raised to a generous shared constant (30 s) per module. A passing test returns immediately, so this changes no timing semantics — it only affects a test that is genuinely stuck. Deadlines that are semantic are deliberately left unchanged: coroutine delay(...) durations, the Netty graceful-shutdown quiet period, the SSE retry: hint value under assertion, and any deadline that is itself the behavior under test.

Also

Documents the cross-compile toolchain discipline in docs/architecture.md (#76): a module targeting a newer JDK must override both jvmToolchain(N) and compilerOptions { jvmTarget }, since overriding only the toolchain emits Java-8 bytecode against newer stdlib symbols (NoSuchMethodError on JDK 8).

Validation

Ran the full build three times with parallel + cache on — twice with --rerun-tasks to force the async tests to genuinely re-execute concurrently rather than be served from cache — all three BUILD SUCCESSFUL.

Closes #74
Closes #76

…timeouts

Turn on org.gradle.caching and org.gradle.parallel in gradle.properties to
reuse task outputs across builds and run independent modules' tasks
concurrently. (org.gradle.configuration-cache is left off and handled
separately.)

Parallel execution runs several modules' test tasks at once, which
oversubscribes CPU cores. The async adapter test suites
(sdk-async-coroutines, sdk-async-reactor, sdk-async-netty,
sdk-async-virtualthreads) used tight 2-5s deadlines on operations that are
expected to complete promptly — future.get(2, SECONDS), withTimeout(2000),
Future.await(2, SECONDS), Mono.block(ofSeconds(2)), and the like. Those
deadlines exist only to stop a stuck test from hanging; they are not the
behaviour under test, but they assume near-dedicated cores and time out under
parallel load. Replace each with a generous per-module FAILSAFE_TIMEOUT
constant (30s): a healthy test still returns the instant its work finishes, so
only a genuinely-stuck test is affected. Semantic timings are left untouched —
coroutine delay(...) calls, Thread.sleep simulating work, Netty's
shutdownGracefully(0, 0, SECONDS) quiet period, and the SSE retry-hint value
under assertion.

Document the cross-compile toolchain rule in docs/architecture.md: a module
that targets a newer JDK must override both jvmToolchain(N) and
compilerOptions { jvmTarget.set(JvmTarget.JVM_N) }. Overriding only the
toolchain compiles against the newer standard library while emitting
Java-8-format bytecode, producing NoSuchMethodError on a Java 8 runtime. The
section is grounded in the existing sdk-transport-jdkhttp (11) and
sdk-async-virtualthreads (21) overrides and notes the --release guard that a
future single-toolchain consolidation would require.
…ipline

CLAUDE.md described the cross-compile override as 'both jvmToolchain and
compilerOptions { jvmTarget }', omitting the java {} block that the build
scripts and docs/architecture.md require. State all three overrides and
point at the architecture-doc section. Also fix a missing paragraph break
in that section so the two paragraphs render separately.
@OmarAlJarrah OmarAlJarrah merged commit b46dfa1 into main Jun 16, 2026
1 check passed
@OmarAlJarrah OmarAlJarrah deleted the build/enable-cache-parallel-and-test-robustness branch June 16, 2026 21:14
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.

Document the cross-compile toolchain discipline for Java-8-target modules Enable Gradle build cache and parallel execution

1 participant