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

Aperta Adatta ai principianti
#5,658 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
83/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Inizia da crates/openshell-sandbox/src/boundary_exec.rs, dove viene mantenuta la copia del socket di output dell’helper SFTP, e ispeziona il normale percorso di uscita dell’helper insieme a signal. Poi leggi trusted_sftp_helper_round_trips_through_boundary_streams e la gestione dello svuotamento dell’output in crates/openshell-sandbox/src/main_session.rs. Il lavoro è completato quando un test unitario conferma che l’output dell’helper raggiunge EOF dopo una normale uscita e i trasferimenti SFTP e scp dell’issue terminano correttamente senza l’attesa di 30 secondi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Rust
Stelle
21.5k
Fork
2.1k
Merge medio
2g 20h
PR unite (30g)
246

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/OpenShell

Tutte le issue di NVIDIA/OpenShell

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.