Skip to content

bug(supervisor): Docker stop takes 5s because the supervisor never reads one of its boundary control connections #5719

Open

Description

@uhrm

User Story

Use of OpenShell for sandboxed code execution of AI agents.

Problem Statement

Possibly related to #5025 / #5342.

Observed: StopSandbox takes ~5.2 s every time. DeleteSandbox is fast (~0.2 s). The sandbox is idle.

docker events: the supervisor container gets kill signal=15 and exits with code 137 exactly 5.0 s later, with no Docker SIGKILL. Then the sandbox container gets signal=15 and exits 1 within ~20 ms.

strace of the supervisor (PID 1 of the supervisor container):

  • SIGTERM, then within 1 ms an exchange of TLS records with openshell-sandbox over a connection accepted on /.openshell/channel/control/supervisor/control.sock, with replies received
  • periodic 5 s work continues: the provider-snapshot push to the boundary, and a new connection to the gateway on port 17670
  • after exactly 5.000 s a futex wakeup, the supervisor closes its sockets and calls exit_group(137) itself

Stuck connection: the supervisor holds two control-socket connections to openshell-sandbox. One is drained. On the other, the supervisor’s receive queue stays at 239 bytes for the sandbox’s lifetime, with 1536 bytes queued on the boundary’s side, and strace shows no reads on that fd before or after SIGTERM:

u_str ESTAB 239 0    …/control.sock 4024898  * 4138044  ("openshell-super",fd=13)
u_str ESTAB 0   1536 *              4138044  * 4024898  ("openshell-sandb",fd=14)

Boundary logs: nothing shutdown-related until its own SIGTERM, then
sandbox boundary received SIGTERM before supervisor confirmation.

Hypothesis: the supervisor starts the stop handshake but waits for a reply on, or depending on, the connection it never reads, so it always hits its 5 s bound. Separately, exiting with 137 makes the bounded shutdown look like a SIGKILL.

Impact / Why This Matters

A 5s delay for stopping an idle sandbox is a performance problem and adversely affects user experience/acceptance.

Acceptance Criteria

With a workload that exits promptly on TERM, or an idle sandbox, stop completes in well under a second.

Reproduction Steps

  1. openshell sandbox create
  2. openshell sandbox stop $SB_NAME (stop command completes only after 5s)

Suggested UX (if applicable)

n/a

Environment

OpenShell 0.1.9 (gateway, openshell-sandbox, openshell-supervisor), Docker driver, Linux.

Logs

Activity

  1. added theissue type on Nov 18, 2026
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

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions