Skip to content

bug(cli): forward start reports 'ssh exited before local forward listener opened' while the listener is live — and leaks an orphaned ssh mux holding the port #3738

Description

@dlynch90

Environment

OpenShell 0.1.1 (Homebrew tap), macOS 15 Apple Silicon, local Docker driver, gateway via brew services.

Reproduction

openshell sandbox create --name web --from python:3.13-alpine -- python3 -m http.server 8080 --bind 0.0.0.0
openshell forward start 18080 web
# × ssh exited before local forward listener opened on 127.0.0.1:18080

Observed

  1. The CLI exits with the readiness error above.
  2. Despite the error, the listener is live: lsof -nP -iTCP:18080 -sTCP:LISTEN shows an ssh process (started with ~/.ssh/control/<hash> [mux]), PPID 1, holding the port.
  3. openshell forward list shows "No active forwards" — the leaked mux is invisible to the registry, so forward stop cannot reclaim it; only a manual kill <pid> cleans up. Retrying forward start on the same port then fails with the (accurate) "Port 18080 is already in use" diagnostic naming the orphan.

Expected

  • The readiness race should either be resolved (wait for the listener before reporting failure) or the tracked forward should be torn down before exiting with the error.
  • On failure, no orphaned ssh mux should survive detached at PPID 1; if one does, it should remain in the forward registry so forward stop (or the next forward start with a prompt) can reclaim it.

Related but distinct: #2999 (SSH-session cleanup ordering), #3051 (structured errors).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions