Skip to content

Fix sync test server port allocation races - #211

Merged
marcus merged 1 commit into
marcus:mainfrom
jubishop:worktree-fixSyncTestPortRaces
Sep 30, 2026
Merged

marcus merged 1 commit into
marcus:mainfrom
jubishop:worktree-fixSyncTestPortRaces

Conversation

@jubishop

Copy link
Copy Markdown
Contributor

The sync end-to-end harness releases its selected port before td-sync binds it. Another process can take that port, causing a flaky startup failure or letting an unrelated HTTP server's health response make startup appear successful.

Initial setup now retries up to five times, only for the current child's confirmed address-in-use failure. Each failed child is reaped before retry, and the final URL is selected before actors save their configuration. Startup requires the child's post-bind startup message and a successful health check. Restarts retain the existing address and data.

Changes are limited to the Go end-to-end harness and six regression cases covering occupied-port health responses, collision recovery and fixed-address restarts, bounded retries, unrelated failures and stale logs, timeout cleanup, and failed process launch.

Fixes jubishop#2.

Submitted upstream from jubishop#3 with the same commit, ae81b34086de9c1b34e43b7100e648f6dfbf170d.

Validation

Validation recorded in the source PR:

  • Red-green regression: the old harness accepted another server's HTTP 200 response on an occupied address; the fixed harness reports the child's bind failure.
  • go test -race ./test/e2e -run '^TestServerStartup$' -count=10 passed.
  • make test passed, including the complete sync end-to-end suite.
  • make lint, GOWORK=off go build ./..., formatting, and whitespace checks passed.
  • Test commands used the repository's release-safe feature environment.

The source PR's GitHub Actions cross-build, lint, and test checks also passed for this commit.

@marcus
marcus merged commit 08adee5 into marcus:main Sep 30, 2026
3 checks passed
@jubishop
jubishop deleted the worktree-fixSyncTestPortRaces branch September 30, 2026 05:01
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.

Fix sync test server port allocation races

2 participants