🧱 Chunk is a download manager for slow and unstable servers

Data race in the CLI progress bar can panic #6

Open cuducos.me
Open opened by cuducos.me

Problem

The CLI progress bar has no synchronization: the 1-second ticker goroutine reads p.files via total(), done() and String() (cmd/chunk/download_progress.go:33-61) while the main goroutine writes it in update() (line 64). There is no mutex.

Impact

Concurrent map read and map write — can panic at runtime.

Reproduction (verified)

3 DATA RACE reports when running the CLI under -race against a slow server.

Suggested fix

Protect files with a mutex (or use sync.Map).

Sign up or Sign in to add to the discussion.