dstack icon indicating copy to clipboard operation
dstack copied to clipboard

[Bug]: Poor connection management in in-server proxy

Open jvstme opened this issue 11 months ago • 1 comments

Problem

The in-server proxy never removes SSH connections to service replicas, even after the replicas were stopped. While the SSH processes can stop automatically, the connection objects are stored in Python memory indefinitely, which can eventually lead to excessive RAM consumption.

Solution

Remove connections to stopped replicas.

Implementation note

The in-server proxy cannot receive events about stopped replicas because they can be stopped by other dstack-server replicas. So the solution may need to introduce a background job to check replica statuses and remove connections accordingly.

Workaround

Restart the dstack server if this ever becomes a problem.

Would you like to help us implement this feature by sending a PR?

Yes

jvstme avatar Jan 28 '25 17:01 jvstme