[paramiko] bad file descriptor - patch included

David Mason paramiko at gptech.com.au
Thu Nov 23 15:42:02 PST 2006


Hi again,

Yesterday I asked about a "bad file descriptor" error that was coming up 
as I was closing the SSH connection.  After some digging I determined 
that it was happening due to the thread not picking up that it is 
inactive until some time after the sockets are closed.  I've fixed this 
by making the close method in Transport wait for the thread to terminate 
*before* it closes the open connection.  I've attached a patch that 
fixes this behaviour (text of patch is also listed below).

Cheers,
David Mason

--- paramiko/transport.py       2006-11-24 10:32:59.000000000 +1100
+++ paramiko/transport.py       2006-11-24 10:33:33.000000000 +1100
@@ -546,10 +546,10 @@
         if not self.active:
             return
         self.active = False
+        self.join()
         self.packetizer.close()
         for chan in self.channels.values():
             chan._unlink()
-        self.join()

     def get_remote_server_key(self):
         """
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: thread_terminate.diff
Url: http://www.lag.net/pipermail/paramiko/attachments/20061124/d8435cc0/attachment.diff 


More information about the paramiko mailing list