Skip to content

Stabilize download conformance tests under cache hits and fix chunk-cache nil race#120

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-failed-test
Draft

Stabilize download conformance tests under cache hits and fix chunk-cache nil race#120
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-failed-test

Conversation

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor

Recent conformance failures came from assuming both clients must always emit identical xorb download HTTP traffic. That assumption breaks when one side serves xorb data from local disk cache; additionally, a concurrent cleanup path could nil out disk cache state during prefetch persistence and panic.

  • Conformance: cache-aware download assertions

    • Updated test/conformance/client/client_test.go to treat missing xorb HTTP requests as valid when caused by cache hits.
    • Kept strict request/range conformance checks when both clients do perform network xorb fetches.
    • Split logging paths for:
      • both clients served from cache
      • one client served from cache
  • Runtime safety: guard prefetch cache writeback race

    • Updated download/chunk_cache.go to skip dc.put(...) when diskCache has been cleared by concurrent Done().
    • Added an inline comment documenting the cleanup/persistence race condition.
// Done() may run concurrently and clear diskCache before prefetch
// persistence reaches EOF; in that case we skip cache writeback.
if dc != nil {
	dc.put(hash, chunkStart, chunkEnd, bytesStart, bytesEnd, metas, file)
}

Copilot AI linked an issue May 12, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 12, 2026 04:03
Copilot AI changed the title [WIP] Fix failed test Stabilize download conformance tests under cache hits and fix chunk-cache nil race May 12, 2026
Copilot AI requested a review from wzshiming May 12, 2026 04:08
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.

Fix failed test

2 participants