feat(gateway): make launched-driver detection non-blocking

未關閉
#5,940 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
55/100
Issue 類型
重構
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust
領域
backend

研究方向

Start in crates/openshell-server/src/cli.rs, where run_cli calls prepare_server_config_with_drivers synchronously from async code, then follow the call into launcher::start, which polls with std:🧵:sleep for up to 30 seconds per candidate. Move that blocking work off the runtime with spawn_blocking or an async start path, and document the detection timeout separately from the explicit-launch timeout. Done means a test where a driver never binds its socket shows detection failing within the documented bound without holding a Tokio worker.

由索引模型根據 Issue 內容生成。

描述

area:drivers

User Story

I run the gateway with launched compute drivers (Docker, Podman, VM) and rely on auto-detection when no driver is named. I directly encountered, while reviewing the launcher, that detection blocks a runtime thread while it waits for a driver to start. This affects how long the gateway takes to fail when a driver hangs.

Problem Statement

Auto-detection runs inside prepare_server_config_with_drivers, which run_cli calls synchronously from async code (crates/openshell-server/src/cli.rs). For each candidate, launcher::start spawns the driver and polls with std::thread::sleep until the driver binds its socket or exits, with a 30 second timeout per candidate. A driver that hangs before binding blocks the calling runtime thread for up to 30 seconds, one candidate at a time.

Impact / Why This Matters

At startup nothing else is served yet, so the effect is a slower failure, not a stall of other work. The same pattern existed for Podman before the launcher change: socket discovery ran synchronously and polled podman info for up to 5 seconds. The launcher change raised the worst case to 30 seconds per candidate. Making detection non-blocking would remove a surprising blocking call from async code and make the timeout a deliberate choice.

Desired Workflow

Detection does not block a runtime thread. The gateway starts each candidate without holding a runtime worker, and the detection timeout is chosen deliberately, separately from the timeout for an explicitly selected driver. Success: a hanging driver delays startup by a bounded, documented time and never blocks a runtime worker.

Acceptance Criteria

  • Detection runs without blocking a Tokio worker, for example through spawn_blocking or an async start path.
  • The detection timeout is documented, and an explicit launch keeps its own timeout.
  • A test covers a driver that never binds its socket.

Related: #5384, #5385. Deferred from the launcher PR to keep that change free of new behaviour.

主要語言
Rust
星號
21.5k
分支
2.1k
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NVIDIA/OpenShell 的其他 Issue

查看 NVIDIA/OpenShell 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。