[paramiko] closing SFTP connections

Michael Gratton michael.gratton at rsp.com.au
Wed Jan 17 16:07:58 PST 2007



Robey Pointer wrote:
> 
> On 17 Dec 2006, at 15:03, Michael Gratton wrote:
>> Yep, but should the transport also automatically close once all channels
>> are closed? We are seeing this happen most times, but for something like
>> 1 in 20 connections, if all channels are closed (we're only opening one
>> per transport) the transport isn't closed.
> 
> It shouldn't ever happen.  You can close all channels but may still want
> to open another channel over the same transport, and that should work.

Oh! Okay, that's weird (the behaviour we're seeing, that is).

It sounds pretty dumb, but we never were explicitly closing a transport.
Channels that get opened were explicitly closed, but the transport never
was.

So during the course of this process running, a transport and channel
would be opened, the channel used then closed and the reference to the
transport lost. This would happen potentially multiple times during the
course of one program execution. Usually the connection associated with
the transport was closed - when the refcount for the transport got to 0
and it was GC'd, I assume. But sometimes the process would not exit
after it completed - a symptom of this was a still-open connection that
the process was constantly select()ing (from memory).

Anyway, it's not a problem anymore as we're now explicitly closing the
transport instances, but it seems like there might be some race or other
condition when open transport instances are destroyed.

Let me know if you want any more info.

/Mike

-- 
Michael Gratton -- Code Wrangler
Rising Sun Pictures -- http://www.rsp.com.au/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://www.lag.net/pipermail/paramiko/attachments/20070118/f10dbdce/attachment.pgp 


More information about the paramiko mailing list