bug(sandbox): scp and sftp stall for 30 s and exit 74 after a successful transfer

未关闭 适合新手
#5,658 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
83/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust

调研方向

从 crates/openshell-sandbox/src/boundary_exec.rs 开始,这里保留了 SFTP helper 输出 socket 的副本;检查 helper 的正常退出路径以及 signal。然后阅读 trusted_sftp_helper_round_trips_through_boundary_streams 和 crates/openshell-sandbox/src/main_session.rs 中的输出排空处理。完成标准是:一个单元测试确认 helper 正常退出后其输出到达 EOF,并且 issue 中的 SFTP 和 scp 传输能够成功完成,不再停顿 30 秒。

由索引模型根据 Issue 内容生成。

描述

User Story

I ran a mini scale test of OpenShell on Kubernetes. Plain ssh into a sandbox worked, but every scp and sftp transfer stalled for about 30 seconds and then failed with exit code 74. I need SFTP to work so file copy tools and editors like VS Code Remote can use a sandbox.

Problem Statement

An SFTP session (from scp, sftp, or VS Code Remote) finishes its work, then hangs for about 30 seconds and fails with:

openshell: exec output could not be delivered intact

The exit code is 74, even when the file was copied correctly.

Why This Happens

The supervisor hands the sftp subsystem to a helper built into the sandbox runtime. When the helper finishes, OpenShell waits for the helper's output stream to close before it reports the exit status.

The output stream never closes. The helper keeps a second copy of its output socket so it can be cancelled later (boundary_exec.rs). That copy is only closed when the helper is killed (signal), not when it exits normally. Because one copy is still open, the reader never sees end-of-file.

After 30 seconds the runtime gives up waiting (REMOTE_OUTPUT_DRAIN_TIMEOUT), marks the output as lost, and returns 74.

I confirmed this with a unit test on main (624aceea3). The test runs a real SFTP session through the helper and closes it. The helper exits 0, but its output never closes. Closing the extra socket copy when the helper exits makes the test pass. The existing test trusted_sftp_helper_round_trips_through_boundary_streams misses this because it checks only the exit status, not end-of-file on the output.

Impact / Why This Matters

  • scp, sftp, and anything built on SFTP (such as VS Code Remote) fail or hang against every sandbox.
  • Scripts treat the transfer as failed because of exit code 74, even when the file arrived.
  • The workaround is openshell sandbox upload and openshell sandbox download, which don't use SFTP. They don't help tools that expect plain SSH file transfer. scp -O (legacy mode) doesn't help either, because sandbox images usually have no scp binary.

Acceptance Criteria

  • scp and sftp to a sandbox exit 0 as soon as the transfer finishes, with no 30-second stall.
  • A unit test checks that the SFTP helper's output reaches end-of-file after a normal exit.

Reproduction Steps

  1. Create a sandbox: openshell sandbox create --name mybox
  2. Add its SSH config: openshell sandbox ssh-config mybox >> ~/.ssh/config
  3. Copy a file: time scp ./somefile openshell-mybox.default:/tmp/
  4. The command hangs for about 30 seconds and exits 74 with "exec output could not be delivered intact".

Environment

  • OpenShell: mini scale test build; code path confirmed on main at 624aceea3
  • Deployment: Kubernetes (Helm), shared supervisor pool
主要语言
Rust
星标
21.5k
派生
2.1k
平均合并
2 天 20 小时
30 天内合并 PR
246

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/OpenShell 的其他 Issue

查看 NVIDIA/OpenShell 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。