Client connections not closed on client deletion
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
client = paramiko.SSHClient('localhost')
client.exec_command('echo me')
del client
Connection still active. Resources not freed.
Creating more clients in same python process leads to memory leaks and eventually OOM.
Cause is client not calling transport.close() at any point.
Sub-classing SSHClient with a __del__ that includes transport.close() leads to race conditions and blocks most definitely related to cyclic references. This has been the case since 1.x and still persists in latest version.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SSHClient lifecycle shown in the reproduction and trace how its transport is created and released. Investigate the reported transport.close() omission and cyclic-reference behavior, then verify that deleting clients frees connections and avoids leaks without introducing races or blocking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100