You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SFTPClient does not keep a reference to the Client #344
This situation is a bit complicated. There was an intentional mechanism which closed the Transport when the SFTPClient was garbage collected, called a "ResourceManager". It was added to prevent connection leaks. The "Add back-reference" commit was not a good idea, it just defeated the "ResourceManager". So I removed both, in #952. That also fixes this, but leaves the possibility of Transport leaking and never closing the connection (if you don't explicitly close it).
So yes I think this issue can be closed. (I don't see any particularly new references, unless these old commits being cherry-picked or rebased onto new branches is doing it.)
Activity
Viggor commentedon Feb 2, 2015
It's because you must return the client variable, if you don't return it the garbage collect it immediatly when the scope change.
FiloSottile commentedon Feb 2, 2015
Yeah, I know why that happens. My point is that that's completely unexpected in a idiomatic Python environment.
SFTPClient should keep a reference to Client so that it doesn't get garbage collected while it's in use.
Add back-reference from Transport to the SSHClient that created it
Add back-reference from Transport to the SSHClient that created it
Add back-reference from Transport to the SSHClient that created it
costela commentedon Aug 30, 2017
Is this ticket still relevant? The example provided seems to work with e58df62 and #44 was closed by it. Any reason this was was just referenced?
ploxiln commentedon Aug 30, 2017
This situation is a bit complicated. There was an intentional mechanism which closed the Transport when the SFTPClient was garbage collected, called a "ResourceManager". It was added to prevent connection leaks. The "Add back-reference" commit was not a good idea, it just defeated the "ResourceManager". So I removed both, in #952. That also fixes this, but leaves the possibility of Transport leaking and never closing the connection (if you don't explicitly close it).
So yes I think this issue can be closed. (I don't see any particularly new references, unless these old commits being cherry-picked or rebased onto new branches is doing it.)
Add back-reference from Transport to the SSHClient that created it
Add back-reference from Transport to the SSHClient that created it