Client doesn't die after server session hang up
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
paramiko |
Invalid
|
Undecided
|
coldas57 |
Bug Description
If you have a shell client session opened, in idle state, and the server closes this session (IdleTimeout), when you try to launch a new command through the shell, the client does not return anymore.
You can test it opening a ssh shell session against an ssh server and afterwards kill that session and then try to send a command. The client hangs and does not return.
If you have a look into channel.py, you will see that Channel class in send method calls _wait_for_
I have solved, but I am not sure if it is the best solution, the problem modifying send method as stated below:
def send(self, s):
"""
Send data to the channel. Returns the number of bytes sent, or 0 if
the channel stream is closed. Applications are responsible for
checking that all data has been sent: if only some of the data was
data.
@param s: data to send.
@type s: str
@return: number of bytes actually sent.
@rtype: int
@raise socket.timeout: if no data could be sent before the timeout set
by L{settimeout}.
"""
size = len(s)
try:
if False == self.transport.
size = self._wait_
if size == 0:
# eof or similar
m = Message()
finally:
return size
I now check the transport session state before doing any channel operation. Could you have a look into this problem and propose a new workaround or fix, please?..or validate this one as the correct fix.
More data:
Client platform: WinXP, Python 2.3.5, paramiko 1.6.3 "xatu"
Server platform: Suse 9, OpenSSH_3.7.1p2, SSH protocols 1.5/2.0, OpenSSL 0.9.7b 10 Apr 2003
I kill the ssh server session before sending a new client command.
Thank you in advance for your assistance
description: | updated |
description: | updated |
Changed in paramiko: | |
assignee: | nobody → coldas57 |
Changed in paramiko: | |
status: | Unconfirmed → Needs Info |
On 3 Nov 2006, at 8:11, coldas57 wrote:
> ** Description changed: send_window( ...) method, where it
>
> If you have a shell client session opened, in idle state, and the
> server
> closes this session (IdleTimeout), when you try to launch a new
> command
> through the shell, the client does not return anymore.
>
> You can test it opening a ssh shell session against an ssh server
> and
> afterwards kill that session and then try to send a command. The
> client
> hangs and does not return.
>
> If you have a look into channel.py, you will see that Channel
> class in
> send method calls _wait_for_
> seems to
> be the problem.
I can't reproduce this on OSX by either closing the SSHClient or kill
-9'ing the sshd process. Could you give me a more specific way to
reproduce it?
Also, what does paramiko log when the server disconnects?
robey