[GH-ISSUE #8445] Multiple goroutines writing to the same file at once likely corrupts downloads #31191

Open
opened 2026-04-22 11:25:17 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @luantak on GitHub (Jan 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8445

What is the issue?

I'm getting a lot of digest errors on windows when downloading new models. Models bigger than 10gb often take multiple tries, for models > 15gb it's nearly impossible to download them.

I think the culprit is likely to be this code:

93a8daf285/server/download.go (L271-L301)

I don't think concurrent writes to the same file are safe (at least on windows), even with offsets.
I think each goroutine should get its own part file which are then merged in the end.

OS

Windows

GPU

AMD

CPU

AMD

Ollama version

0.5.6

Originally created by @luantak on GitHub (Jan 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8445 ### What is the issue? I'm getting a lot of digest errors on windows when downloading new models. Models bigger than 10gb often take multiple tries, for models > 15gb it's nearly impossible to download them. I think the culprit is likely to be this code: https://github.com/ollama/ollama/blob/93a8daf285af45ed71544e79aae0cb15245e75f4/server/download.go#L271-L301 I don't think concurrent writes to the same file are safe (at least on windows), even with offsets. I think each goroutine should get its own part file which are then merged in the end. ### OS Windows ### GPU AMD ### CPU AMD ### Ollama version 0.5.6
GiteaMirror added the bug label 2026-04-22 11:25:17 -05:00
Author
Owner

@luantak commented on GitHub (Jan 16, 2025):

Also see #8105

<!-- gh-comment-id:2594396975 --> @luantak commented on GitHub (Jan 16, 2025): Also see #8105
Author
Owner

@luantak commented on GitHub (Apr 30, 2025):

@mxyng @jmorganca @jessegross I don't want to be pushy, but this issue is quite important as it leads to the verify stage of the download often failing on windows (often have to download the same model 5+ times).

<!-- gh-comment-id:2843184325 --> @luantak commented on GitHub (Apr 30, 2025): @mxyng @jmorganca @jessegross I don't want to be pushy, but this issue is quite important as it leads to the verify stage of the download often failing on windows (often have to download the same model 5+ times).
Author
Owner

@mxyng commented on GitHub (Apr 30, 2025):

io.OffsetWriter is safe for concurrent use. Unless there's a bug in core Go (possible but unlikely), this probably isn't the issue. That being said, there's an experimental client which aims to fix this and other issues. See #10331 for more details.

<!-- gh-comment-id:2843504504 --> @mxyng commented on GitHub (Apr 30, 2025): [`io.OffsetWriter`](https://pkg.go.dev/io#OffsetWriter) is safe for concurrent use. Unless there's a bug in core Go (possible but unlikely), this probably isn't the issue. That being said, there's an experimental client which aims to fix this and other issues. See #10331 for more details.
Author
Owner

@luantak commented on GitHub (May 1, 2025):

Ok will investigate if that's indeed a go issue on windows. As this is only an issue with large files, it seems likely it could have slipped through as windows is a more "niche" os for go.

<!-- gh-comment-id:2844129455 --> @luantak commented on GitHub (May 1, 2025): Ok will investigate if that's indeed a go issue on windows. As this is only an issue with large files, it seems likely it could have slipped through as windows is a more "niche" os for go.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#31191