Skip to content

fix(coverage): retry data-socket connect to survive a briefly-unavailable receiver#205

Open
slayerjain wants to merge 1 commit into
mainfrom
fix/coverage-socket-connect-retry
Open

fix(coverage): retry data-socket connect to survive a briefly-unavailable receiver#205
slayerjain wants to merge 1 commit into
mainfrom
fix/coverage-socket-connect-retry

Conversation

@slayerjain

Copy link
Copy Markdown
Member

Problem

The go-dedup coverage-sync CI lane intermittently fails with could not connect to keploy data socket. sendToSocket did a single net.Dial to keploy's unix data socket; under CPU starvation keploy's receiver accept is momentarily unavailable (the socket file is re-created each run and the single accept loop can be briefly starved → ENOENT/ECONNREFUSED). A one-shot dial drops that test's coverage report permanently, and the lane then fails its coverage-completeness check.

Fix

Wrap the connect in dialDataSocketWithRetry: capped exponential backoff (25ms→400ms), retries only transient transport errors (ECONNREFUSED/ENOENT/deadline), bounded by a 5s budget that stays under keploy's 10s ACK read deadline (the END handler writes its ACK only after sendToSocket returns).

It retries only the idempotent connect — never re-derives or fabricates coverage data — so a genuinely-down socket still errors loudly and a real miss is never masked.

Tests

keploy/coverage_dial_test.go (auth-free):

  • ...DeliversWhenListenerAppearsLate — the listener appears after a transient absent window; the retry connects (a single dial would have dropped the report).
  • ...FailsWithinBudgetWhenNoListener — a permanently-down socket still errors, within the bounded budget (no hang, no mask).

Builds on all platforms (syscall.ECONNREFUSED/ENOENT are defined cross-platform); golangci-lint clean.

…vailable receiver

The coverage reporter did a single net.Dial to keploy's unix data socket; under
CPU starvation keploy's accept is momentarily unavailable (ENOENT/ECONNREFUSED),
so that test's coverage report was dropped permanently ('could not connect to
keploy data socket'), failing the lane's coverage-completeness check.

Wrap the connect in a bounded retry (capped exponential backoff, transient errors
only, 5s budget under keploy's 10s ACK deadline). Retries only the idempotent
connect -- never re-derives coverage data, so a genuinely-down socket still errors.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
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