Skip to content

Chunk part directories are unguarded across processes #1303

Closed

Description

@yigitdot

Residual from #1301, which fixed the in-process case.

The part directory for a chunked download is keyed only on the manifest hash (<data_dir>/downloads/<H_manifest>/). #1301 added a per-manifest-hash lock in PullCtx so two bundle pull entries naming the same manifest serialize, but that lock is process-local.

Two concurrent decdn invocations reconstructing the same manifest still share the directory:

  • with --no-keep-blobs, one process's cleanup deletes parts while the other is mid-concatenate (its File::open fails, or it gets a short read)
  • without it, both fetch and pay for every chunk twice
  • it is also the only realistic way to reach the total_bytes mismatch guard that fix(cli): harden DECDNMAN reconstruction after review of #1293 #1301 moved to before the rename — a part mutating between verification and concatenation

Options: an advisory lock file in the part dir (needs a dependency or a hand-rolled O_EXCL + staleness policy), or keying the directory per-invocation when keep_blobs is false — though that trades the race for an orphan directory whenever a --no-keep-blobs run is interrupted, since cleanup only happens on success.

Low priority: concurrent downloads of the same large file from one machine are an unusual shape, and the failure is loud rather than silent.

Activity

  1. added
    kind:bug
    rust
    prio:low
    on Jul 19, 2026
  2. altanoruc commented on Jul 20, 2026

    @altanoruc
    Contributor

    Automated triage note for a later run: the issue is not decision-free yet. Please choose advisory locking or per-invocation part directories. For advisory locking, pin the primitive/dependency, lock-file location, crash cleanup, and stale-lock policy; those choices determine correctness across processes.

  3. self-assigned this
    on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugprio:lowrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions