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

オープン 初心者向け
#5,658 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

SFTP ヘルパーの出力ソケットのコピーが保持されている crates/openshell-sandbox/src/boundary_exec.rs から始め、signal と併せてヘルパーの通常終了経路を調べます。次に trusted_sftp_helper_round_trips_through_boundary_streams と、crates/openshell-sandbox/src/main_session.rs にある出力のドレイン処理を読みます。通常終了後にヘルパーの出力が 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時間
マージ済み PR(30日)
246

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/OpenShell のほかの issue

NVIDIA/OpenShell の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。