Skip to content

fix(core): make socket teardown deterministic - #15

Merged
andrescera merged 1 commit into
masterfrom
agent/srt-required-test-stability
Jul 14, 2026
Merged

fix(core): make socket teardown deterministic#15
andrescera merged 1 commit into
masterfrom
agent/srt-required-test-stability

Conversation

@andrescera

Copy link
Copy Markdown
Member

Affected repo & language: CERALIVE/srt — C/C++

What

Make socket teardown deterministic across the required epoll, file-transfer, and IPv6 reuse tests. The public close wrapper now preserves its existing idempotent contract when garbage collection retires a socket between the public state lookup and internal close acquisition. Test socket owners release handles exactly once, finite transfers finish by their known byte count, and readiness is registered before launching a fast peer.

Why

The post-merge master gates exposed three real nondeterministic failures: TestEPoll.SimpleAsync, C++03 Transmission.FileUpload in run 29290208582, and Windows ReuseAddr.SameAddrV6 in attempt 1 of run 29290208546. Successful retries did not resolve their ownership, close-acquisition, and readiness-registration races.

How to verify

  • Run the full native suite with ctest --test-dir <build> --output-on-failure.
  • Run the exact C++03 workflow configuration and full CTest suite.
  • Stress the focused filters: ownership 1000 iterations, epoll 100, C++03 file upload 20, and IPv6 reuse 100 under concurrent load.
  • Run uvx codespell --config scripts/codespell/codespell.cfg and git diff --check.

Local results: native full suite green; exact C++03 full suite green; every focused stress iteration passed with strict close assertions and no SRT_EINVSOCK. All workflows remain byte-identical to master; Actionlint/YAML, cache assertions, release/runtime invariants, and cold/warm package replacement gates remain green.

Risks

The production behavior change is deliberately narrow: only SRT_ERROR plus SRT_EINVSOCK after an initially nonterminal socket state is converted to idempotent success. Other close errors propagate unchanged. The test changes preserve existing waits, C++03 expectations, and release gates; no skip, retry, timeout, or assertion was weakened.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md)
  • Started from updated master after PR ci: add bounded ccache to C++ workflows #14; branch is based directly on 857442d
  • Rule D local-scratch reference check passes for tracked files
  • Full tests and hands-on QA evidence pass

Preserve idempotent close semantics when garbage collection retires a valid socket between state lookup and internal acquisition. Keep test ownership, readiness registration, and finite-transfer completion deterministic while retaining strict close assertions.
@andrescera
andrescera merged commit 293ae6f into master Jul 14, 2026
15 checks passed
@andrescera
andrescera deleted the agent/srt-required-test-stability branch July 17, 2026 17:46
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