Skip to content

cold-store: atlas /dump download cut mid-transfer (curl 18) on every attempt; endpoint ignores Range so no resume is possible #13115

Open

Description

@dezren39

Problem

The atlas Turso export can now fail one stage earlier than #12000's rebuild defect: the /dump download itself is cut mid-transfer, and the endpoint offers no way to resume.

First-hand evidence, 2026-11-23 01:57–02:23 CST (a standalone run of the atlas leg of export-turso.sh — token mint, /dump download, filters, rebuild — filing nothing):

  • 4 download attempts (the script's initial try + --retry 3 --retry-all-errors): all four ended curl: (18) transfer closed with outstanding read data remaining, at varying offsets (the first reached ~1.28 GB; later attempts were cut far earlier).
  • Range probe straight after: the endpoint answers a Range: request with HTTP 200 and no Content-Range — it ignores the header and streams from the start, so curl -C - resume cannot work against it.
  • Throughput in the probe's last windows was ~3–6 KB/s (76–190 KB per 30 s), far below the ~3 MB/s the same download started at — the stream is being starved or stalled, then closed.

Circumstantial match: the 2026-11-22 nightly filed 50 databases (transfer ledger, 09:12–09:44 UTC) but no atlas, and cold-store-nightly.service exited FAILURE at 04:20 CST. Atlas is exported last, so a download that keeps getting cut fits — but it cannot be confirmed after the fact, because no output from the unit survives: journalctl --user -u cold-store-nightly.service returns no entries at all.

Relation to #12000

Distinct stage. #12000's defect (rebuild dying on a duplicated chunk_id from a repeated table in the dump) is fixed — dedupe/vector-index filters on main — and its acceptance was met on 2026-11-19 and 2026-11-21 (atlas filed, 3,581,679,110 bytes gzipped each time; filing only happens after integrity_check = ok and the user-table check pass). This issue is the download stage that now fails first on bad nights.

Ask

  1. Durable nightly output: the nightly unit's per-step outcome and ERROR lines must survive the run (a log file under the cold-store home, or equivalent), so the next failure names its stage without a live probe.
  2. A download strategy that survives a cut, non-resumable stream: e.g. spread the largest database's whole-download retries across the run's existing deadline budget instead of four attempts inside a few minutes, so a bad window can pass; or an alternate export path for atlas. Restarting a 10+ GB stream from zero on every attempt is the current shape and it is not working on bad nights.
  3. Acceptance: three consecutive nightly runs file an atlas export, or one files it on a night when a probe shows the stream being cut.

Found by Lane LR while reconciling #12000.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claimed by Lane OK (sandbox fix lane, archer). Scope this pass: ask 1 (durable nightly output — per-step outcome + ERROR lines survive the run in a log under the cold-store home) and ask 2 (download retries for the largest database spread across the run's existing deadline budget instead of four attempts inside a few minutes). Ask 3 (three consecutive nightly filings) is calendar-gated and stays open after this slice.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claim — Lane OJ (archer), 2026-11-23. Taking the landable slice of this issue: ask 1 (durable nightly output — per-step outcome and ERROR lines must survive the run in a log under the cold-store home) and, if the script shape allows it cleanly, the retry-spreading half of ask 2. Ask 3 (three consecutive nightly runs) is calendar acceptance and stays open after my slice lands.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Flag hold — Lane OK. The laptop worktree ~/wt-lane-ok-13115 (branch lane-ok-13115, at main 3a941eff430e) was created, but the creation result tripped a platform execution-risk check on the checkout's content. Per the standing rule for this flag class, no git/build/test operations were run inside it and it is left untouched at the base SHA. Nothing was implemented.

    Premise verified read-only (contents API, current main): pkgs/cold-store-reaper/scripts/nightly-backup.sh prints per-step outcomes to the console only — nothing persists a run record under the cold-store home; pkgs/cold-store-reaper/scripts/export-turso.sh gives failed databases exactly ONE retry pass after TURSO_DUMP_RETRY_PASS_DELAY_SECONDS (default 60s), and within a download curl's --retry 3 --retry-delay 30 — so all of atlas's attempts land inside a few minutes, matching the 2026-11-23 evidence in this issue.

    Prepared scope (ready to land on Drew's item-specific go-ahead for executing in ~/wt-lane-ok-13115):

    1. Ask 1 — durable nightly output: in nightly-backup.sh, duplicate stdout and stderr to a dated log file under ${COLD_STORE_HOME:-~/.config/cold-store}/logs/ while preserving the stdout/stderr split on the console (the existing tests assert FAILED lines on stderr, ok lines on stdout — that contract stays). Extend tests/test_nightly_backup.py: a run with a forced step failure leaves a log file containing both the step's ERROR line and its FAILED outcome line.
    2. Ask 2 — spread retries across the deadline: in export-turso.sh, replace the single retry pass with bounded retry passes over the still-failing databases: the delay before retry pass k doubles from TURSO_DUMP_RETRY_PASS_DELAY_SECONDS, capped by a new TURSO_DUMP_RETRY_PASS_MAX_DELAY_SECONDS (default 1800); at most TURSO_DUMP_RETRY_PASSES retry passes (default 5); a pass is skipped (failures stand, loudly) when the run's remaining deadline no longer leaves room for the delay plus the existing 60s minimum-start window. Both new envs validated as integers in the script's existing style. Tests: update test_database_failing_both_passes_fails_the_run to the new policy (a database failing every pass fails the run; dump calls = 1 + RETRY_PASSES under the defaults) and add tests pinning delay growth/cap and the deadline stop.
    3. Ask 3 stays open regardless: three consecutive nightly filings is calendar-gated acceptance, not part of this slice.
  5. added a commit that references this issue on Nov 23, 2026
  6. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane OJ — asks 1 and 2 landed; the issue stays open on ask 3 (calendar acceptance).

    PR #13152 merged (14904d788a34, head SHA-guarded at d22136af08e):

    • Ask 1 (durable nightly output): scripts/nightly-backup.sh tee's the whole run (stdout+stderr merged into one chronological stream) to $COLD_STORE_HOME/logs/nightly-<timestamp>.log; nightly-latest.log symlinks the newest run. The exit code is the run's own verdict (PIPESTATUS), never tee's. If the log directory cannot be created, the run proceeds without the file and warns loudly — logging never breaks the backup. The next failed night names its failing step from that file alone.
    • Ask 2 (download strategy): after the existing second pass, download-stage failures — and only those; a rebuild or filing failure is deterministic — keep being retried in further passes while the run's deadline leaves room for the wait plus one useful attempt window (60s, the same floor export_one applies before starting a database). The wait doubles between passes, capped at 900s. A retry-pass delay of 0 asks for no waiting, so the spread passes do not engage and the run ends after the second pass, exactly as before (this preserves the repo's fast failing-dump test harnesses, which configure 0). Failure accounting is exact across stage transitions.

    Verification: test_nightly_backup.py 5/5 (2 new tests); test_export_turso.py 35/35 (1 new test: a dump cut on the first two passes files on a deadline-spread third pass; the always-failing test now pins delay 1s + a 75s deadline and asserts the named no-room stop). test_cold_store.py's export-script class fails identically on pristine main tonight — a real export run is holding the script's lock and every failure there is the lock message; environmental, not this change.

    Remaining: ask 3 — three consecutive nightly runs file an atlas export (or one files it on a night when a probe shows the stream being cut). The first post-merge nightly is the first datapoint; the durable log from ask 1 is what makes the verdict readable either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions