Skip to content

[SDK Sentinel] Fix race in AsyncPoller suspend test - #3105

Open
sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/java/36794672368-1-7950b6ec6b39
Open

sdk-sentinel-bot wants to merge 1 commit into
temporalio:mainfrom
sdk-sentinel-forks:automation/sdk-sentinel/ci-flake/java/36794672368-1-7950b6ec6b39

Conversation

@sdk-sentinel-bot

Copy link
Copy Markdown
Contributor

Caution

This PR contains untrusted AI-generated code. Do not approve or run CI until a maintainer has reviewed the diff. SDK Sentinel verified that GitHub Actions remained approval-gated with zero executable jobs when this PR was opened.

Summary

Stabilize the AsyncPoller suspend test after the [first captured failing execution](https://github.com/temporalio/sdk-java/actions/runs/36594382094/job/109495407337). The [last captured pass before that failure](https://github.com/temporalio/sdk-java/actions/runs/36578377393/job/109439798275) exercised the same unit test. There are no public API, breaking, or server changes.

Root cause

The test could suspend polling before the second poll-loop iteration called reserveSlot. That iteration then remained behind the suspend latch, so the assertion observed one reservation instead of two. A later test-classification change had removed the existing wait for the retained reservation counter.

Fix

Wait until the second reserveSlot call begins before suspending polling. This establishes the intended ordering without sleeps, retries, production changes, or weaker assertions.

Validation

The focused JDK 23 test passed six times, and the full test class passed once. The unchanged baseline validator passed. Candidate validation could not start in the investigation sandbox because Gradle could not change permissions on its preloaded daemon cache. Normal CI must run the fixed validator and Cloud unit-test job; the race did not reproduce locally before the change.

Validation status: validation-incomplete

  • Flake confidence: high
  • Fix confidence: high
  • Value: medium
  • Patch scope: standard — 1 changed file; 1.9 KiB
  • Local reproduction: not-reproduced — One unpatched focused execution passed; the bounded CI job provides the natural reproduction.
  • Regression coverage: pass-after-only — The existing regression test passed six focused repetitions and once within its full class after restoring the ordering barrier.
  • Unchanged baseline (Gradle formatting and test-source compilation) — passed
  • Independent candidate (Gradle formatting and test-source compilation) — did not pass (failure)

Investigator-run checks

  • GRADLE_USER_HOME=.ci-flake-runtime/tmp/gradle-home ./gradlew --offline --no-daemon :temporal-sdk:cleanTest :temporal-sdk:test --tests 'io.temporal.internal.worker.AsyncPollerTest.testSuspendPolling' -x :temporal-serviceclient:initSubmodules -x :temporal-serviceclient:updateSubmodules -x :temporal-sdk:compileJava17Java — passed; 6 attempt(s). All six patched JDK 23 executions passed.
  • GRADLE_USER_HOME=.ci-flake-runtime/tmp/gradle-home ./gradlew --offline --no-daemon :temporal-sdk:cleanTest :temporal-sdk:test --tests 'io.temporal.internal.worker.AsyncPollerTest' -x :temporal-serviceclient:initSubmodules -x :temporal-serviceclient:updateSubmodules -x :temporal-sdk:compileJava17Java — passed; 1 attempt(s). The complete AsyncPollerTest class passed.
  • GRADLE_USER_HOME=.ci-flake-runtime/tmp/gradle-home ./gradlew --offline --no-daemon spotlessApply -x :temporal-serviceclient:initSubmodules -x :temporal-serviceclient:updateSubmodules — passed; 1 attempt(s). Repository formatting completed successfully; git diff --check also passed.
  • .ci-flake-runtime/input/validate.sh (trusted unchanged baseline) — passed; 1 attempt(s). The trusted unchanged baseline completed successfully.
  • .ci-flake-runtime/input/validate.sh (candidate) — failed; 1 attempt(s). Gradle could not start because the sandbox forbids chmod on the preloaded daemon registry; no repository task executed.

Required target CI

  • Fixed repository validator: .ci-flake-runtime/input/validate.sh
  • Continuous Integration / Unit test with cloud (Linux, JDK 23)

Residual risks

  • The unpatched race did not reproduce locally.
  • Independent candidate validation was blocked by sandbox cache permissions.
  • Three secondary credible flake clusters remain unfixed.

Automation provenance

If this finding should not be fixed, apply the sdk-sentinel:false-positive label and close the PR. Sentinel will suppress the finding until its affected source changes.

SDK Sentinel recurrence history

  • Unique failed CI run attempts: 1
  • First occurrence: 2026-09-29 16:12 UTC
  • Latest occurrence: 2026-09-29 16:12 UTC
  • Recent occurrences:

@sdk-sentinel-bot
sdk-sentinel-bot requested a review from a team as a code owner October 1, 2026 00:49

This branch has not been deployed

No deployments
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.

1 participant