{"record":{"id":"8b6948329ff443d1","repo":"t8y2/dbx","slug":"rss-probe-timed-out-join-stderr-lines","errorCode":null,"errorMessage":"RSS probe timed out: {'; '.join(stderr_lines)}","messagePattern":"RSS probe timed out: (.+?)","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/bench/run.py","lineNumber":159,"sourceCode":"        assert process.stderr is not None\n        stderr_lines.extend(line.rstrip() for line in process.stderr)\n\n    threading.Thread(target=drain_stderr, daemon=True).start()\n    try:\n        assert process.stdout is not None\n        deadline = time.monotonic() + env_float(\"BENCH_READY_TIMEOUT\", 30.0)\n        while time.monotonic() < deadline:\n            line = process.stdout.readline()\n            if line == \"\" and process.poll() is not None:\n                raise RuntimeError(f\"RSS probe exited early: {'; '.join(stderr_lines)}\")\n            try:\n                payload = json.loads(line)\n            except json.JSONDecodeError:\n                continue\n            if payload.get(\"ready\") is True:\n                break\n        else:\n            raise TimeoutError(f\"RSS probe timed out: {'; '.join(stderr_lines)}\")\n        time.sleep(0.2)\n        completed = subprocess.run(\n            [\"ps\", \"-o\", \"rss=\", \"-p\", str(process.pid)],\n            text=True,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            check=True,\n        )\n        return float(completed.stdout.strip())\n    finally:\n        process.terminate()\n        try:\n            process.wait(timeout=5)\n        except subprocess.TimeoutExpired:\n            process.kill()\n            process.wait(timeout=5)\n\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/bench/run.py#L141-L177","documentation":"measure_rss() waits up to BENCH_READY_TIMEOUT (default 30s) for the probe's stdout to emit a JSON line with ready=true. If the deadline passes without a ready signal, the for/else raises TimeoutError listing accumulated stderr lines — the probe is alive but never reported readiness.","triggerScenarios":"The probe keeps running but never prints {\"ready\": true} within the deadline: slow startup, readiness line sent to stderr, JSON payloads that never include ready=true, or stdout buffering delaying the line past the timeout.","commonSituations":"BENCH_READY_TIMEOUT too short for a cold-starting JVM/database; tool version emits a different readiness key; output block-buffered because stdout is a pipe without flush; probe stuck initializing (e.g. waiting on its own dependency).","solutions":["Increase the timeout: export BENCH_READY_TIMEOUT=120","Ensure the probe flushes stdout (print(..., flush=True)) when printing the ready JSON","Verify the readiness payload key is exactly ready with value true in the tool version in use","Check stderr in the message for hints the probe is stuck (waiting on a resource/port)","Run the probe manually to observe how long readiness actually takes"],"exampleFix":"// before\nexport BENCH_READY_TIMEOUT=30  # TimeoutError: RSS probe timed out\n// after\nexport BENCH_READY_TIMEOUT=120","handlingStrategy":"retry","validationCode":"def preflight_ready_latency(cmd: list[str], env: dict) -> float:\n    start = time.monotonic()\n    # time a manual run to learn real readiness latency, then size the timeout\n    subprocess.run(cmd, env=env, capture_output=True, text=True)\n    return time.monotonic() - start  # set BENCH_READY_TIMEOUT well above this","typeGuard":null,"tryCatchPattern":"try:\n    rss = measure_rss(command, environment)\nexcept TimeoutError as e:\n    print(f\"probe never reported ready:\\n{e}\")\n    print(\"retrying with a larger timeout\")\n    environment[\"BENCH_READY_TIMEOUT\"] = \"120\"\n    rss = measure_rss(command, environment)","preventionTips":["Set BENCH_READY_TIMEOUT generously for cold starts (JVM/db init can exceed 30s)","Ensure the probe flushes stdout after printing the ready JSON when stdout is a pipe","Verify the readiness payload uses key ready with value true for your tool version","Time readiness manually once per environment and set the timeout to several times that"],"tags":["timeout","subprocess","readiness-probe","python"],"backgroundTag":"process-startup-timeout","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}