Skip to content

enable TCP keepalive, and replay in-flight resends on every reconnect - #74

Merged
david415 merged 2 commits into
mainfrom
fix-unconditional-replay-keepalive
Sep 6, 2026
Merged

enable TCP keepalive, and replay in-flight resends on every reconnect#74
david415 merged 2 commits into
mainfrom
fix-unconditional-replay-keepalive

Conversation

@tirewapped

@tirewapped tirewapped commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

fix: replay in-flight resends on every reconnect

Replay was gated on the daemon instance token changing. On a same-instance
drop, a request written into a socket that died before the daemon read it
was never delivered again; the caller's _send_and_wait blocked forever,
wedging the client. The tracked requests are keyed by envelope hash and the
daemon handles re-issues idempotently (BoxAlreadyExists on writes, re-read
of the same box on reads), so replaying on every reconnect is safe. Adds
worker-loop unit tests pinning this behavior.

fix: enable TCP keepalive + user timeout on daemon socket

A silently dead peer (no FIN/RST) left recv() blocked forever, so the
worker loop never detected the drop and never replayed in-flight requests.
Set SO_KEEPALIVE with 10s/10s/3 probes and TCP_USER_TIMEOUT 30s so the
kernel aborts a dead link and surfaces an error to the read loop.

Deckard added 2 commits September 5, 2026 21:57
Replay was gated on the daemon instance token changing. On a same-instance
drop, a request written into a socket that died before the daemon read it
was never delivered again; the caller's _send_and_wait blocked forever,
wedging the client. The tracked requests are keyed by envelope hash and the
daemon handles re-issues idempotently (BoxAlreadyExists on writes, re-read
of the same box on reads), so replaying on every reconnect is safe. Adds
worker-loop unit tests pinning this behavior.
A silently dead peer (no FIN/RST) left recv() blocked forever, so the
worker loop never detected the drop and never replayed in-flight requests.
Set SO_KEEPALIVE with 10s/10s/3 probes and TCP_USER_TIMEOUT 30s so the
kernel aborts a dead link and surfaces an error to the read loop.
@david415
david415 merged commit 40b91cd into main Sep 6, 2026
3 checks passed
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.

2 participants