Summary
On a fresh install, tma1-server can get stuck in an infinite GreptimeDB download → 5‑minute‑timeout → retry loop on slower connections, never reaching a healthy state. The dashboard never comes up and the only signal is a repeating failed to install greptimedb ... context deadline exceeded line in the log.
Environment
- TMA1
v0.2.0-alpha7, macOS (darwin/arm64)
- GreptimeDB
v1.1.1, asset greptime-darwin-arm64-v1.1.1.tar.gz is ~150 MB (content-length: 150472626)
- Connection throughput during repro: ~27 MB/min
Root cause
server/internal/install/install.go:45
downloadClient = &http.Client{Timeout: 5 * time.Minute}
This Timeout is the total deadline for the whole request, including streaming the response body in downloadAndExtract (install.go:~348):
resp, err := downloadClient.Get(url)
...
_, err = io.Copy(dst, resp.Body) // <- the 5-min clock is still ticking here
A 150 MB tarball at ~27 MB/min needs ~5.5 min — just over the cap — so io.Copy dies mid‑stream with context deadline exceeded, the partial download is discarded, and EnsureGreptimeDB retries from scratch with no Range/resume and no backoff (observed retry ~2 s after the failure). On any connection where the download is slower than 150 MB / 5 min, this loops forever.
Observed log
18:21:24 INFO downloading greptimedb version=v1.1.1
18:26:24 ERROR failed to install greptimedb err="install: download .../greptime-darwin-arm64-v1.1.1.tar.gz: context deadline exceeded (Client.Timeout or context cancellation while reading body)"
18:26:26 INFO downloading greptimedb version=v1.1.1 # immediate retry, restarts at 0 bytes
Steps to reproduce
- Throttle the network to < ~30 MB/min (or repro on any moderately slow link).
curl -fsSL https://tma1.ai/install.sh | TMA1_VERSION=v0.2.0-alpha7 bash
- Watch
~/Library/Logs/tma1-server.log — the download fails at the 5‑min mark and retries indefinitely; curl http://localhost:14318/health never returns ok.
Impact
First‑run experience hard‑fails for anyone on a slower connection, with no actionable message (just a repeating timeout). Likely to grow as the GreptimeDB binary gets larger.
Workaround
Download the tarball out of band, drop greptime into ~/.tma1/bin/greptime (chmod +x), write v1.1.1 to ~/.tma1/bin/.version, and restart the service — EnsureGreptimeDB then sees the binary and skips the download.
Suggested fixes (any subset)
- Don't cap body read with a wall‑clock total timeout. Drop
Client.Timeout for the download client and instead enforce a stall timeout (idle/read deadline) so a slow‑but‑progressing transfer isn't killed. e.g. http.Transport{ResponseHeaderTimeout: ...} + a stall‑detecting reader, or a context you reset on progress.
- Resumable download via HTTP
Range so a retry continues from the partial file instead of restarting at 0.
- Backoff + attempt cap between retries, with a clear terminal error after N attempts instead of an infinite silent loop.
- Progress / clearer messaging (bytes downloaded, total) so a stuck/slow download is diagnosable from the log.
Summary
On a fresh install,
tma1-servercan get stuck in an infinite GreptimeDB download → 5‑minute‑timeout → retry loop on slower connections, never reaching a healthy state. The dashboard never comes up and the only signal is a repeatingfailed to install greptimedb ... context deadline exceededline in the log.Environment
v0.2.0-alpha7, macOS (darwin/arm64)v1.1.1, assetgreptime-darwin-arm64-v1.1.1.tar.gzis ~150 MB (content-length: 150472626)Root cause
server/internal/install/install.go:45This
Timeoutis the total deadline for the whole request, including streaming the response body indownloadAndExtract(install.go:~348):A 150 MB tarball at ~27 MB/min needs ~5.5 min — just over the cap — so
io.Copydies mid‑stream withcontext deadline exceeded, the partial download is discarded, andEnsureGreptimeDBretries from scratch with noRange/resume and no backoff (observed retry ~2 s after the failure). On any connection where the download is slower than 150 MB / 5 min, this loops forever.Observed log
Steps to reproduce
curl -fsSL https://tma1.ai/install.sh | TMA1_VERSION=v0.2.0-alpha7 bash~/Library/Logs/tma1-server.log— the download fails at the 5‑min mark and retries indefinitely;curl http://localhost:14318/healthnever returnsok.Impact
First‑run experience hard‑fails for anyone on a slower connection, with no actionable message (just a repeating timeout). Likely to grow as the GreptimeDB binary gets larger.
Workaround
Download the tarball out of band, drop
greptimeinto~/.tma1/bin/greptime(chmod +x), writev1.1.1to~/.tma1/bin/.version, and restart the service —EnsureGreptimeDBthen sees the binary and skips the download.Suggested fixes (any subset)
Client.Timeoutfor the download client and instead enforce a stall timeout (idle/read deadline) so a slow‑but‑progressing transfer isn't killed. e.g.http.Transport{ResponseHeaderTimeout: ...}+ a stall‑detecting reader, or acontextyou reset on progress.Rangeso a retry continues from the partial file instead of restarting at 0.