XX-net/XX-Net · error · Exception
time out
Error message
time out
What it means
Raised by download_file in gae_proxy's download_gae_lib.py when the total elapsed time of reading the GAE lib download exceeds the caller-supplied timeout before the stream ends. Each loop iteration computes time_left = timeout - elapsed; once negative it throws a generic Exception('time out'). It is a wall-clock deadline applied to the whole HTTP body read, not a per-read socket timeout.
Source
Thrown at code/default/gae_proxy/local/download_gae_lib.py:59
if not req:
time.sleep(3)
continue
if req.status == 302:
url = req.headers["Location"]
continue
start_time = time.time()
timeout = 300
if req.chunked:
downloaded = 0
with open(filename, 'wb') as fp:
while True:
time_left = timeout - (time.time() - start_time)
if time_left < 0:
raise Exception("time out")
dat = req.read(timeout=time_left)
if not dat:
break
fp.write(dat)
downloaded += len(dat)
return True
else:
file_size = int(req.getheader('Content-Length', 0))
left = file_size
downloaded = 0
with open(filename, 'wb') as fp:
while True:
chunk_len = min(65536, left)
if not chunk_len:View on GitHub (pinned to cfa5bc17b6)
Solutions
- Increase the timeout argument passed to download_file / download_unzip
- Retry the download (transient slowness is common); wrap download_unzip in a retry loop with backoff
- Check network/proxy throughput and pause other bandwidth-heavy tasks
- If repeatedly timing out at the same byte count, verify the URL still serves the file and isn't hanging
Example fix
// before
download_unzip(url, target_path, timeout=30)
// after
for i in range(3):
try:
download_unzip(url, target_path, timeout=300)
break
except Exception as e:
if 'time out' not in str(e) or i == 2:
raise
time.sleep(5) Defensive patterns
Strategy: retry
Try / catch
try:
download_unzip(url, path, timeout=600)
except Exception as e:
if 'time out' in str(e):
# transient: retry with bigger budget
download_unzip(url, path, timeout=1800)
else:
raise Prevention
- Pass a timeout sized to file size over worst-case bandwidth, not best-case
- Wrap module downloads in a bounded retry loop with backoff
- Monitor elapsed progress so stalls are detected before the hard deadline
When it happens
Trigger: Calling download_file(url, filename, timeout=N) where the server sends data slower than the body can complete in N seconds, or the connection stalls after partial data; also when the file is large and timeout is too small relative to bandwidth.
Common situations: Slow or throttled network to Google/GitHub servers, small hardcoded timeout values, downloading a large archive (e.g. GoAgent lib) over a proxy, temporary server slowness.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/018905e6004a1c01.
Report an issue: GitHub.