[paramiko] bad file descriptor - patch included
David Mason
paramiko at gptech.com.au
Mon Nov 27 18:07:54 PST 2006
Hi there,
The patch you provided works great, thanks!
David Mason
Robey Pointer wrote:
> On 23 Nov 2006, at 15:42, David Mason wrote:
>
>
>> 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).
>>
>
> Joining the thread before the packetizer is closed may cause the
> packetizer to never realize that it should stop, though. (The unit
> tests break for this reason -- good demonstration of why they're
> actually useful!) :)
>
> I think a better fix would be to notice when a socket.error happens
> because of EOF, and translate the exception. Patch below -- does
> this fix it for you too?
>
> robey
>
>
> === modified file 'paramiko/packet.py'
> --- paramiko/packet.py 2006-11-12 06:30:54 +0000
> +++ paramiko/packet.py 2006-11-27 19:13:31 +0000
> @@ -218,6 +218,8 @@
> # we need to work around it.
> if (type(e.args) is tuple) and (len(e.args) > 0)
> and (e.args[0] == errno.EAGAIN):
> got_timeout = True
> + elif self.__closed:
> + raise EOFError()
> else:
> raise
> if got_timeout:
>
>
> _______________________________________________
> paramiko mailing list
> paramiko at lag.net
> http://www.lag.net/mailman/listinfo/paramiko
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lag.net/pipermail/paramiko/attachments/20061128/01aa6d6c/attachment.htm
More information about the paramiko
mailing list