{"record":{"id":"fa5098dd5a9471e7","repo":"XX-net/XX-Net","slug":"time-out-fa5098","errorCode":null,"errorMessage":"time out","messagePattern":"time out","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"code/default/launcher/download_modules.py","lineNumber":41,"sourceCode":"            if not req:\n                time.sleep(60)\n                continue\n\n            if req.status == 302:\n                url = req.headers[b\"Location\"]\n                continue\n\n            start_time = time.time()\n            timeout = 300\n\n            if req.chunked:\n\n                downloaded = 0\n                with open(filename, 'wb') as fp:\n                    while True:\n                        time_left = timeout - (time.time() - start_time)\n                        if time_left < 0:\n                            raise Exception(\"time out\")\n\n                        dat = req.read(timeout=time_left)\n                        if not dat:\n                            break\n\n                        fp.write(dat)\n                        downloaded += len(dat)\n\n                return True\n            else:\n                file_size = int(req.getheader(b'Content-Length', 0))\n\n                left = file_size\n                downloaded = 0\n                with open(filename, 'wb') as fp:\n                    while True:\n                        chunk_len = min(65536, left)\n                        if not chunk_len:","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/download_modules.py#L23-L59","documentation":"Same deadline pattern as gae_proxy's download_file, but in launcher/download_modules.py: the module download loop computes time_left = timeout - elapsed and raises Exception('time out') once negative before the next read. It bounds the whole module archive download, used by download_unzip and the download_worker thread.","triggerScenarios":"download_file for a launcher module (e.g. a new module zip) when throughput is too low to finish within timeout, or the connection stalls mid-body.","commonSituations":"Slow GitHub/CDN access (common in censored regions), small timeout defaults, large module archives, proxy interference.","solutions":["Retry the module download; check_update/download_worker will re-attempt on next run","Increase the timeout passed to download_file / download_unzip","Verify network to the download host (curl the module URL)","Use a system proxy/mirror if GitHub is slow from your region"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        download_unzip(module_url, module_path, timeout=600)\n        break\n    except Exception as e:\n        if 'time out' not in str(e) or attempt == 2:\n            raise\n        time.sleep(10)","preventionTips":["Scale timeout with module archive size","Retry module downloads on next launcher run instead of failing hard","Route through a proxy if the module host is slow from your region"],"tags":["launcher","download","timeout","network"],"backgroundTag":"download-timeout","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}