# debugger: Fix endless restarts when connecting to TCP adapters over SSH \(\#34328\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1b6e212ebaf5bc8797edacefff119a4f49fb0287)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1b6e212ebaf5bc8797edacefff119a4f49fb0287

Requested commit: 1b6e212ebaf5bc8797edacefff119a4f49fb0287

Commit: 1b6e212ebaf5bc8797edacefff119a4f49fb0287

Tree: 39f69205142cdf62c31cbe07d89baa3a876e4628

Author: Cole Miller

Committer: GitHub

## Message

```
debugger: Fix endless restarts when connecting to TCP adapters over SSH (#34328)

Closes #34323
Closes #34313

The previous PR #33932 introduced a way to "close" the
`pending_requests` buffer of the `TransportDelegate`, preventing any
more requests from being added. This prevents pending requests from
accumulating without ever being drained during the shutdown sequence;
without it, some of our tests hang at this point (due to using a
single-threaded executor).

The bug occurred because we were closing `pending_requests` whenever we
detected the server side of the transport shut down, and this closed
state stuck around and interfered with the retry logic for SSH+TCP
adapter connections.

This PR fixes the bug by only closing `pending_requests` on session
shutdown, and adds a regression test covering the SSH retry logic.

Release Notes:

- debugger: Fixed a bug causing SSH connections to some adapters
(Python, Go, JavaScript) to fail and restart endlessly.
```

## Parents

- [46834d31f139b7d9d1fdf1a1e072437f7f128e29](https://git.cafe/gitcafe/zed/commit/46834d31f139b7d9d1fdf1a1e072437f7f128e29?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1b6e212ebaf5bc8797edacefff119a4f49fb0287?format=markdown)
