dstack icon indicating copy to clipboard operation
dstack copied to clipboard

[Bug]: `dstack attach` doesn't exit when connection is dropped

Open jsadusk opened this issue 5 months ago • 3 comments

Steps to reproduce

When attached via dstack apply, if the connection drops (possibly due to a laptop going to sleep and coming back), dstack will notify the user and exit, allowing the user to reconnect with dstack apply. However if the connection is via dstack apply it will never exit, even if there is no longer any connection. This causes any open connections to a dev environment to just hang, forcing the user to guess the connection is dropped, ctrl-c the apply command, and reconnect.

To repro:

  • Apply an environment with dstack apply
  • Disconnect from the environment by ctrl-c on the apply command
  • Attach to the environment with dstack attach
  • Force connection to drop by bringing down networking, sleeping the local machine, etc

Actual behaviour

dstack attach stays running as if the connection is still alive, causing anything running over the ssh tunnel to hang.

Expected behaviour

dstack attach should exit when the connection is dropped.

dstack version

0.19.12

Server logs


Additional information

No response

jsadusk avatar Jul 15 '25 16:07 jsadusk