[PR #15020] fix: preserve partial chunk progress before returning fatal download errors #77266

Open
opened 2026-05-05 09:56:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15020
Author: @jasonkwh
Created: 3/23/2026
Status: 🔄 Open

Base: mainHead: fix/preserve-chunk-progress-on-download-error


📝 Commits (1)

  • e6bba88 server: preserve chunk progress to disk before rolling back on fatal download errors

📊 Changes

1 file changed (+6 additions, -5 deletions)

View changed files

📝 server/download.go (+6 -5)

📄 Description

Problem

When downloadChunk encountered a fatal error (e.g. unexpected network failure), it rolled back b.Completed and returned immediately without saving the bytes already received to the part file. On the next retry, the chunk would restart from the beginning, wasting bandwidth — particularly costly for large model files.

Fix

Move part.Completed.Add(n) and writePart before the fatal error check so partial progress is always flushed to disk first. The b.Completed rollback is kept for fatal errors to maintain an accurate global progress counter, but the chunk bytes are no longer discarded.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15020 **Author:** [@jasonkwh](https://github.com/jasonkwh) **Created:** 3/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/preserve-chunk-progress-on-download-error` --- ### 📝 Commits (1) - [`e6bba88`](https://github.com/ollama/ollama/commit/e6bba886012aa2cea57e2301faced594f1e43872) server: preserve chunk progress to disk before rolling back on fatal download errors ### 📊 Changes **1 file changed** (+6 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `server/download.go` (+6 -5) </details> ### 📄 Description ## Problem When `downloadChunk` encountered a fatal error (e.g. unexpected network failure), it rolled back `b.Completed` and returned immediately without saving the bytes already received to the part file. On the next retry, the chunk would restart from the beginning, wasting bandwidth — particularly costly for large model files. ## Fix Move `part.Completed.Add(n)` and `writePart` before the fatal error check so partial progress is always flushed to disk first. The `b.Completed` rollback is kept for fatal errors to maintain an accurate global progress counter, but the chunk bytes are no longer discarded. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 09:56:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77266