{"record":{"id":"72d35b902b63131c","repo":"unslothai/unsloth","slug":"no-inference-subprocess-running","errorCode":null,"errorMessage":"No inference subprocess running","messagePattern":"No inference subprocess running","errorType":"exception","errorClass":"RuntimeError","httpStatus":500,"severity":"error","filePath":"studio/backend/core/inference/orchestrator.py","lineNumber":540,"sourceCode":"\n            suffix = \"\"\n            if sig_name == \"SIGKILL\":\n                suffix = (\n                    \" This usually means the system killed it under memory pressure. \"\n                    \"Try a smaller model, lower context length, or close other GPU-heavy apps.\"\n                )\n            return f\"{message}{suffix} Details: pid={pid}, signal={sig_name}, exitcode={exitcode}.\"\n\n        return f\"{message} Details: pid={pid}, exitcode={exitcode}.\"\n\n    # ------------------------------------------------------------------\n    # Queue helpers\n    # ------------------------------------------------------------------\n\n    def _send_cmd(self, cmd: dict) -> None:\n        \"\"\"Send a command to the subprocess.\"\"\"\n        if self._cmd_queue is None:\n            raise RuntimeError(\"No inference subprocess running\")\n        try:\n            self._cmd_queue.put(cmd)\n        except (OSError, ValueError) as exc:\n            raise RuntimeError(f\"Failed to send command to subprocess: {exc}\")\n\n    def _read_resp(self, timeout: float = 1.0) -> Optional[dict]:\n        \"\"\"Read a response from the subprocess (non-blocking with timeout).\"\"\"\n        if self._resp_queue is None:\n            return None\n        try:\n            return self._resp_queue.get(timeout = timeout)\n        except queue.Empty:\n            return None\n        except (EOFError, OSError, ValueError):\n            return None\n\n    def _wait_response(\n        self,","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/orchestrator.py#L522-L558","documentation":"Orchestrator._send_cmd raises this RuntimeError when it is asked to enqueue a command but self._cmd_queue is None — the inference subprocess (and its queues) was never started or has already been torn down. Every control command (load, generate, stop) goes through this queue, so any command sent outside a subprocess's lifetime fails here.","triggerScenarios":"Calling any command-sending method (e.g. load/generate/stop paths that use _send_cmd) before start_subprocess() created the queues, or after stop()/crash teardown set them to None.","commonSituations":"Code path that generates without checking the worker is running; race where the worker crashed and teardown finished between a liveness check and the command send; calling orchestrator methods after explicit shutdown.","solutions":["Check the subprocess is alive (e.g. _ensure_subprocess_alive / is_running equivalent) before issuing commands","Start the subprocess before the first command in the request path","On this error, restart the subprocess and re-issue the command rather than propagating to the user"],"exampleFix":"# before\norchestrator._send_cmd({'type': 'generate', ...})\n\n# after\nif not orchestrator.is_running():\n    await orchestrator.start_subprocess()\norchestrator._send_cmd({'type': 'generate', ...})","handlingStrategy":"validation","validationCode":"if not orchestrator.is_running():  # or: orchestrator._cmd_queue is None\n    await orchestrator.start_subprocess()","typeGuard":"def can_send_commands(orchestrator) -> bool:\n    return orchestrator._cmd_queue is not None","tryCatchPattern":"try:\n    orchestrator._send_cmd(cmd)\nexcept RuntimeError as exc:\n    if 'No inference subprocess running' in str(exc):\n        await orchestrator.start_subprocess()\n        orchestrator._send_cmd(cmd)\n    else:\n        raise","preventionTips":["Check subprocess liveness before every command batch, not once at startup","Suppress or route UI actions that send commands after shutdown","Restart the worker in a supervisor when it dies so command queues are re-created"],"tags":["orchestrator","subprocess","lifecycle","ipc"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}