[SDK Sentinel] Retry automatic dev server port collisions - #3041
Open
sdk-sentinel-bot wants to merge 1 commit into
Open
Conversation
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.
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 automatic Temporal dev-server startup. The CLI-backed suite passed in the [preceding CI run](https://github.com/temporalio/sdk-java/actions/runs/33017156613) and failed in the [first captured bad run](https://github.com/temporalio/sdk-java/actions/runs/33024141969) when its selected loopback port was already occupied. There are no breaking changes and no server PR is required.
Root cause
Automatic selection opened an ephemeral-port probe and closed it before spawning the CLI. Another process could claim that port during the resulting time-of-check/time-of-use gap, causing the CLI listener to exit.
Fix
When the launcher selected the port, retry with a fresh port only after a recognized address-in-use failure. Explicit ports and unrelated startup failures remain single-attempt. Add an integration test that deliberately occupies the first selection.
Validation
Changed source and test classes compile, module formatting passes, and four loopback forced-collision checks recovered successfully. The unchanged baseline passed. Full validation and JUnit execution remain required in CI because this sandbox cannot update submodule metadata and lacks the offline JUnit runtime.
Validation status:
validation-incompletehighmediummediumstandard— 2 changed files; 5.8 KiBreproduced— A loopback check forced the first automatic port to be occupied, reproducing the bind collision; the candidate recovered on all four attempts. Natural scheduling reproduction was not attempted.not-run— A deterministic pinned-CLI integration test was added and compiled, but its JUnit runtime was unavailable in the offline cache. Equivalent standalone checks passed.Gradle formatting and test-source compilation) — passedGradle formatting and test-source compilation) — did not pass (failure)Investigator-run checks
.ci-flake-runtime/input/validate.sh (trusted unchanged baseline)— passed; 1 attempt(s). The unchanged baseline completed spotlessCheck and testClasses successfully.Focused Gradle JUnit execution attempts for TemporalDevServerLauncherIntegrationTest— failed; 3 attempt(s). JUnit execution was blocked by read-only submodule metadata and then unavailable offline runtime artifacts.Loopback ForcedPortCollisionCheck using the pinned Temporal CLI— passed; 4 attempt(s). Each attempt deliberately occupied the first selected port; the launcher selected a second port, started successfully, and shut down../gradlew --offline --no-daemon :temporal-testing:testClasses -x :temporal-serviceclient:initSubmodules -x :temporal-serviceclient:updateSubmodules -x :temporal-sdk:compileJava17Java— passed; 1 attempt(s). Affected Java 8-compatible production and test classes compiled successfully../gradlew --offline --no-daemon :temporal-testing:spotlessCheck— passed; 1 attempt(s). Formatting checks for the changed module passed..ci-flake-runtime/input/validate.sh— failed; 1 attempt(s). Candidate validation stopped when Gradle attempted to write read-only .git submodule configuration; this was an investigation-sandbox limitation.Required target CI
Residual risks
Automation provenance
6d5ba591bb405da453870c85767599777ade0241If this finding should not be fixed, apply the
sdk-sentinel:false-positivelabel and close the PR. Sentinel will suppress the finding until its affected source changes.SDK Sentinel recurrence history
2026-08-26 23:54 UTC2026-08-26 23:54 UTC