{"record":{"id":"1ca72797a91ae7f6","repo":"t8y2/dbx","slug":"iotdb-is-not-reachable-at-host-port","errorCode":null,"errorMessage":"IoTDB is not reachable at {host}:{port}","messagePattern":"IoTDB is not reachable at (.+?):(.+?)","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/bench/run.py","lineNumber":103,"sourceCode":"        [\"go\", \"build\", \"-o\", str(GO_BINARY), \".\"],\n        cwd=BENCH_DIR / \"go\",\n        check=True,\n        stdout=sys.stderr,\n        stderr=sys.stderr,\n    )\n\n\ndef wait_for_server(environment: dict[str, str]) -> None:\n    host = environment.get(\"IOTDB_HOST\", \"127.0.0.1\")\n    port = int(environment.get(\"IOTDB_PORT\", \"6667\"))\n    deadline = time.monotonic() + env_float(\"BENCH_SERVER_TIMEOUT\", 60.0)\n    while time.monotonic() < deadline:\n        try:\n            with socket.create_connection((host, port), timeout=1):\n                return\n        except OSError:\n            time.sleep(0.5)\n    raise TimeoutError(f\"IoTDB is not reachable at {host}:{port}\")\n\n\ndef run_json(command: list[str], environment: dict[str, str]) -> dict:\n    completed = subprocess.run(\n        command,\n        env=environment,\n        text=True,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.PIPE,\n        check=False,\n        timeout=env_float(\"BENCH_COMMAND_TIMEOUT\", 180.0),\n    )\n    if completed.returncode != 0:\n        raise RuntimeError(\n            f\"command failed ({' '.join(command)}):\\nstdout:\\n{completed.stdout}\\nstderr:\\n{completed.stderr}\"\n        )\n    for line in reversed(completed.stdout.splitlines()):\n        try:","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/bench/run.py#L85-L121","documentation":"wait_for_server() polls a TCP connection to the IoTDB server for a bounded period (retries every 0.5s with 1s connect timeouts). If the server never accepts a connection before the deadline it raises TimeoutError naming the host:port. This is a startup-readiness guard for the benchmark harness.","triggerScenarios":"IoTDB is not started, listens on a different host/port than the benchmark's env config, is still initializing past the deadline, or a firewall/network policy blocks the port — every socket.create_connection attempt raises OSError until time runs out.","commonSituations":"Forgetting to start the IoTDB container before running bench/run.py; wrong BENCH host/port env; slow first-time startup (WAL replay) exceeding the wait window; Docker network misconfiguration.","solutions":["Start the IoTDB server and confirm it listens: ss -ltnp | grep <port>","Verify host/port env vars match the server's actual bind address","Test connectivity manually: python -c \"import socket;socket.create_connection(('host',port),timeout=2)\"","Increase the wait deadline in main()/wait_for_server if startup is legitimately slow","Check firewall/security-group rules if the server runs on another host"],"exampleFix":"// before\n$ python run.py   # TimeoutError: IoTDB is not reachable at localhost:6667\n// after\n$ docker compose up -d iotdb && python run.py   # or fix BENCH_IOTDB_PORT=6667","handlingStrategy":"validation","validationCode":"import socket\n\ndef server_is_up(host, port, timeout=2.0):\n    try:\n        with socket.create_connection((host, port), timeout=timeout):\n            return True\n    except OSError:\n        return False\n\nassert server_is_up(host, port), f\"start IoTDB at {host}:{port} first\"","typeGuard":null,"tryCatchPattern":"try:\n    wait_for_server(host, port)\nexcept TimeoutError:\n    sys.exit(f\"IoTDB unreachable at {host}:{port}; start it or fix host/port\")","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":["network","timeout","connectivity","server-startup"],"backgroundTag":"connection-refused","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"}