🧱 Chunk is a download manager for slow and unstable servers

The timeout flag can only shrink the effective per-chunk timeout; a stuck server retries forever #5

Open cuducos.me
Open opened by cuducos.me

Problem

DefaultDownloader bakes Client.Timeout = 90s into the HTTP client (downloader.go:445). The -t/--timeout flag only changes d.Timeout, which controls the per-chunk context, but the client aborts every request at 90s regardless — so -t 300 behaves as 90s, while -t 30 works because the context fires first.

On top of that, timeouts deliberately do not count toward MaxRetries (downloader.go:282-289), and the CLI never cancels its context. A server that accepts TCP but never responds therefore makes the CLI retry every 90s indefinitely with no cap.

Reproduction (verified)

  • -t 300 against a slow chunk: aborted at 90s.
  • Server that never responds: CLI loops forever.

Suggested fix

Make the client timeout follow the configured value (or drop Client.Timeout and rely on the per-chunk context), and add a cap or documentation for consecutive-timeout retries.

Sign up or Sign in to add to the discussion.