[paramiko] Paramiko's leaking file descriptors

David Guerizec david at guerizec.net
Sun Nov 19 05:47:58 PST 2006


Hello,

I've been trying to optimize file descriptors utilisation in sshproxy, and I 
found that paramiko is leaking file descriptors when using Channel.fileno() 
method.

What is happening is when calling fileno(), a pipe object is created, using 2 
file descriptors, but when a channel is closed by the remote side (that is 
not explicitly by calling Channel.close()), the pipe's FDs are not closed but 
the paramiko Pipe object is doing like so, by setting self._forever.

I've made a patch (attached to this message) to close these file descriptors 
when the Pipe.set_forever() method is called, and that seems to fix my 
problem.

Regards,

David

-- 
http://penguin.fr/sshproxy/  "An ACL-driven proxy on SSH2"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paramiko_pipe.patch
Type: text/x-diff
Size: 716 bytes
Desc: not available
Url : http://www.lag.net/pipermail/paramiko/attachments/20061119/d85feb4e/attachment.bin 


More information about the paramiko mailing list