{"record":{"id":"059ddaa291b9e6c9","repo":"unslothai/unsloth","slug":"timeout-waiting-for-expected-type-response-no","errorCode":null,"errorMessage":"Timeout waiting for '{expected_type}' response (no activity for {timeout}s)","messagePattern":"Timeout waiting for '(.+?)' response \\(no activity for (.+?)s\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":500,"severity":"error","filePath":"studio/backend/core/inference/orchestrator.py","lineNumber":614,"sourceCode":"            if rtype == \"status\":\n                logger.info(\"Subprocess status: %s\", resp.get(\"message\", \"\"))\n                # Reset deadline — subprocess is still alive and working\n                deadline = time.monotonic() + timeout\n                continue\n\n            if rtype == \"stall\":\n                msg = resp.get(\"message\", \"Download stalled\")\n                logger.warning(\"Subprocess reported stall: %s\", msg)\n                raise DownloadStallError(msg)\n\n            # Other response types during wait — skip\n            logger.debug(\n                \"Skipping response type '%s' while waiting for '%s'\",\n                rtype,\n                expected_type,\n            )\n\n        raise RuntimeError(\n            f\"Timeout waiting for '{expected_type}' response (no activity for {timeout}s)\"\n        )\n\n    def _drain_queue(self) -> list:\n        \"\"\"Drain all pending responses.\"\"\"\n        events = []\n        if self._resp_queue is None:\n            return events\n        while True:\n            try:\n                events.append(self._resp_queue.get_nowait())\n            except queue.Empty:\n                return events\n            except (EOFError, OSError, ValueError):\n                return events\n\n    def _direct_reader(self, request_id: str):\n        \"\"\"Response reader for a _gen_lock generation, safe once compare exists.","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/orchestrator.py#L596-L632","documentation":"Raised when the response-pump loop in _wait_response exhausts its deadline without ever receiving the expected response type. Note that 'status' heartbeats reset the deadline, so this fires only after a full timeout window with no activity at all — the subprocess is alive but silent (or its responses are not matching expected_type).","triggerScenarios":"Waiting for 'loaded' during a very slow model download/load that exceeds the timeout, a worker wedged in a non-yielding C extension, or waiting for a response type that was already consumed by another waiter.","commonSituations":"Large model (~70B) load exceeding the configured timeout on slow disks, a stuck download with no stall detection triggered, GPU driver hang inside the worker, or timeout passed too small for cold-cache downloads.","solutions":["Increase the timeout argument for the load/generation call to cover cold-cache downloads.","Check subprocess logs to see whether it was still legitimately working (progress) or hung.","Verify network throughput to the model hub — slow downloads are the usual cause.","If the worker is genuinely wedged, restart the backend to respawn the subprocess.","Confirm no other thread drained the expected response from the shared queue first."],"exampleFix":"// before\norchestrator.load_model(name, timeout=300)\n// after\norchestrator.load_model(name, timeout=3600)  # cover cold-cache download","handlingStrategy":"retry","validationCode":"import shutil\n# estimate before loading: check free disk vs repo size before a long download\nassert shutil.disk_usage(\"/\").free > 50 * 2**30, \"not enough disk for model\"","typeGuard":null,"tryCatchPattern":"try:\n    orchestrator.load_model(name, timeout=3600)\nexcept RuntimeError as e:\n    if \"Timeout waiting for\" in str(e):\n        retry_with_longer_timeout(e)","preventionTips":["Size timeouts to cold-cache download time, not warm loads.","Pre-warm the HF cache for large models.","Watch 'status' heartbeats in logs to distinguish progress from a hang."],"tags":["inference","timeout","subprocess","loading"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}