mirror of
https://github.com/ollama/ollama.git
synced 2026-09-04 02:11:05 +00:00
* progress: fix data races on ticker, states, spinner, and bar state NewProgress spawned start() which wrote p.ticker while stop() read and cleared it with no synchronization; stop() and StopAndClear() also read p.states and p.pos outside p.mu, Spinner's start() goroutine raced Stop() and String() on s.value/s.stopped/s.ticker, and Bar.Set raced Bar.String on currentValue/stopped/buckets (callback goroutine vs the render goroutine). Detected by go test -race across cmd and cmd/launch (~20 warnings; the Bar race is latent — never flagged because tests don't interleave it, but real in production pull/push progress). Create tickers before spawning the render goroutines and pass the channel in, guard Progress internals with p.mu throughout stop() (via a renderLocked core), and give Spinner and Bar their own mutexes. * use a more idiomatic channel based done signal |
||
|---|---|---|
| .. | ||
| bar.go | ||
| progress.go | ||
| progress_test.go | ||
| spinner.go | ||
| stepbar.go | ||