continuous sync serial dial pass lets offline peers delay every theory #18

Closed
opened 2026-07-16 04:27:48 +00:00 by anuna-02 · 0 comments
anuna-02 commented 2026-07-16 04:27:48 +00:00 (Migrated from codeberg.org)

Summary

Continuous sync awaits every theory/peer dial serially. An unreachable peer in one old theory therefore delays sync attempts for unrelated active theories. ELEPHANT_SYNC_INTERVAL is effectively "sleep after the entire serial pass", not the maximum retry interval for each peer.

Reproduction from the two-machine run

The daemon was configured with ELEPHANT_SYNC_INTERVAL=30. Relevant log times were:

03:53:00.775  constitution peer timed out
03:53:00.986  rc-live peer: connection lost
03:53:31.313  rootclaim peer timed out
03:53:34.929  another peer had no addressing information

03:54:36.193  constitution peer timed out
03:54:36.251  rc-live peer: connection lost

Subsequent rc-live attempts occurred at approximately 94-96 second intervals, despite the configured 30-second interval. The same pattern continued for the duration of the run.

Cause

src/p2p/sync.rs::dial_once loops over every local theory and roster peer and awaits dial_sync, open_bi, and the whole sync session inline. run_with_endpoint then sleeps for interval before invoking the next full pass. One or more transport timeouts are added directly to every peer's retry cadence.

Impact

  • A stale/offline member in an unrelated theory degrades convergence for active theories.
  • Delay grows with the number of unreachable roster peers.
  • The reconnect/discovery latency budget cannot be enforced per peer.
  • Repeated full-pass retries create avoidable DHT/relay traffic and noisy logs.

Expected / acceptance criteria

  • Schedule each (theory, peer) independently, or execute a snapshot of due peers with bounded concurrency.
  • Give each peer independent timeout, jittered backoff, last-attempt state, and cancellation on daemon shutdown.
  • An offline peer in theory A must not delay the first attempt or retry cadence for a reachable peer in theory B.
  • Add a deterministic scheduler regression with one never-completing dial and one immediately-ready dial.
  • Feed per-peer outcomes into the health reporting tracked by #15.
  • Keep concurrency bounded so a large roster cannot create unbounded tasks or sockets.

Environment

Elephant 0.1.2, macOS, two-machine FLF run. The serial structure is also present on current main (130a910).

### Summary Continuous sync awaits every theory/peer dial serially. An unreachable peer in one old theory therefore delays sync attempts for unrelated active theories. `ELEPHANT_SYNC_INTERVAL` is effectively "sleep after the entire serial pass", not the maximum retry interval for each peer. ### Reproduction from the two-machine run The daemon was configured with `ELEPHANT_SYNC_INTERVAL=30`. Relevant log times were: ```text 03:53:00.775 constitution peer timed out 03:53:00.986 rc-live peer: connection lost 03:53:31.313 rootclaim peer timed out 03:53:34.929 another peer had no addressing information 03:54:36.193 constitution peer timed out 03:54:36.251 rc-live peer: connection lost ``` Subsequent `rc-live` attempts occurred at approximately 94-96 second intervals, despite the configured 30-second interval. The same pattern continued for the duration of the run. ### Cause `src/p2p/sync.rs::dial_once` loops over every local theory and roster peer and awaits `dial_sync`, `open_bi`, and the whole sync session inline. `run_with_endpoint` then sleeps for `interval` before invoking the next full pass. One or more transport timeouts are added directly to every peer's retry cadence. ### Impact - A stale/offline member in an unrelated theory degrades convergence for active theories. - Delay grows with the number of unreachable roster peers. - The reconnect/discovery latency budget cannot be enforced per peer. - Repeated full-pass retries create avoidable DHT/relay traffic and noisy logs. ### Expected / acceptance criteria - Schedule each `(theory, peer)` independently, or execute a snapshot of due peers with bounded concurrency. - Give each peer independent timeout, jittered backoff, last-attempt state, and cancellation on daemon shutdown. - An offline peer in theory A must not delay the first attempt or retry cadence for a reachable peer in theory B. - Add a deterministic scheduler regression with one never-completing dial and one immediately-ready dial. - Feed per-peer outcomes into the health reporting tracked by #15. - Keep concurrency bounded so a large roster cannot create unbounded tasks or sockets. ### Environment Elephant 0.1.2, macOS, two-machine FLF run. The serial structure is also present on current `main` (`130a910`).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
anuna-research/elephant#18
No description provided.