zed-industries/zed · error · TimeoutError

judge proxy did not open port

Error message

judge proxy did not open port {self._port} in time

What it means

_wait_for_port gives the judge proxy a fixed 30-second window (probing every 250 ms) to start listening. If the deadline passes while the process is still alive but nothing accepts connections on 127.0.0.1:<port>, this TimeoutError is raised. The proxy is hung or slow, not crashed — a crash produces the sibling 'exited before becoming ready' RuntimeError instead.

Solutions

  1. Pass a larger timeout_secs to _wait_for_port if startup is legitimately slow
  2. Pre-install the proxy's dependencies in the image so startup fits the 30 s budget
  3. Inspect the proxy log to see how far startup progressed
  4. If it is hung rather than slow, add startup logging to the proxy or attach a debugger before bind()

Example fix

# before
proxy._wait_for_port()  # TimeoutError: judge proxy did not open port 8765 in time

# after
proxy._wait_for_port(timeout_secs=120.0)
Defensive patterns

Strategy: retry

Try / catch

last_error = None
for attempt in range(3):
    try:
        proxy._wait_for_port(timeout_secs=30.0 * (attempt + 1))
        break
    except TimeoutError as err:
        last_error = err
else:
    raise last_error

Prevention

When it happens

Trigger: Calling rejudge when the proxy takes over 30 s to boot: cold-start model client initialization, dependency installation inside the proxy, DNS or credential lookups stalling, or a deadlock in the proxy before it binds the port.

Common situations: First run on a slow CI runner downloading packages; proxy waiting on a slow remote auth endpoint; containers with restricted loopback networking; heavily loaded machine running many trials in parallel.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/9a0a36be43d09f24. Report an issue: GitHub.

Appendix: source

Thrown at crates/eval_cli/zed_eval/rejudge.py:195

    def __exit__(self, *_exc: object) -> None:
        if self._process is not None:
            self._process.terminate()
            try:
                self._process.wait(timeout=10)
            except subprocess.TimeoutExpired:
                self._process.kill()

    def _wait_for_port(self, timeout_secs: float = 30.0) -> None:
        deadline = time.time() + timeout_secs
        while time.time() < deadline:
            if self._process is not None and self._process.poll() is not None:
                raise RuntimeError("judge proxy exited before becoming ready")
            with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as probe:
                probe.settimeout(0.5)
                if probe.connect_ex(("127.0.0.1", self._port)) == 0:
                    return
            time.sleep(0.25)
        raise TimeoutError(f"judge proxy did not open port {self._port} in time")


def _stage_tests_dir(tests_dir: Path) -> None:
    """Point the absolute `/tests` path at this trial's package. Reset per trial
    so each verifier reads its own rubrics/prompts."""
    if TESTS_DIR.is_symlink() or TESTS_DIR.exists():
        if TESTS_DIR.is_dir() and not TESTS_DIR.is_symlink():
            shutil.rmtree(TESTS_DIR)
        else:
            TESTS_DIR.unlink()
    TESTS_DIR.symlink_to(tests_dir)


def _run_verifier(
    part: str, tests_dir: Path, judge_model: str, port: int
) -> dict[str, Any]:
    """Stage the verifier's expected inputs and run the real cached script."""
    LOGS_AGENT_DIR.mkdir(parents=True, exist_ok=True)

View on GitHub (pinned to f4178619ac)