2006-11-03 14:44:45 |
coldas57 |
bug |
|
|
added bug |
2006-11-03 15:10:38 |
coldas57 |
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_send_window(...) method, where it seems to be the problem.
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
transmitted, the application needs to attempt delivery of the remaining
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)
self.lock.acquire()
try:
self._log(DEBUG,"DSR: about to wait_for_send_window")
if True == self.transport.is_active():
size = self._wait_for_send_window(size)
self._log(DEBUG,"DSR: wait_for_send_window exited, " +str(size))
if size == 0:
# eof or similar
return 0
m = Message()
m.add_byte(chr(MSG_CHANNEL_DATA))
m.add_int(self.remote_chanid)
m.add_string(s[:size])
self._log(DEBUG,"DSR: about to send data through transport" + str(self.transport))
self.transport._send_user_message(m)
else:
raise SSHException('Transport session has been unexpectedly closed')
finally:
self.lock.release()
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.
Thank you in advance for your assistance |
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_send_window(...) method, where it seems to be the problem.
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
transmitted, the application needs to attempt delivery of the remaining
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)
self.lock.acquire()
try:
if False == self.transport.is_active():
raise SSHException('Transport session has been unexpectedly closed')
size = self._wait_for_send_window(size)
if size == 0:
# eof or similar
return 0
m = Message()
m.add_byte(chr(MSG_CHANNEL_DATA))
m.add_int(self.remote_chanid)
m.add_string(s[:size])
self.transport._send_user_message(m)
finally:
self.lock.release()
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.
Thank you in advance for your assistance |
|
2006-11-03 16:11:19 |
coldas57 |
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_send_window(...) method, where it seems to be the problem.
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
transmitted, the application needs to attempt delivery of the remaining
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)
self.lock.acquire()
try:
if False == self.transport.is_active():
raise SSHException('Transport session has been unexpectedly closed')
size = self._wait_for_send_window(size)
if size == 0:
# eof or similar
return 0
m = Message()
m.add_byte(chr(MSG_CHANNEL_DATA))
m.add_int(self.remote_chanid)
m.add_string(s[:size])
self.transport._send_user_message(m)
finally:
self.lock.release()
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.
Thank you in advance for your assistance |
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_send_window(...) method, where it seems to be the problem.
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
transmitted, the application needs to attempt delivery of the remaining
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)
self.lock.acquire()
try:
if False == self.transport.is_active():
raise SSHException('Transport session has been unexpectedly closed')
size = self._wait_for_send_window(size)
if size == 0:
# eof or similar
return 0
m = Message()
m.add_byte(chr(MSG_CHANNEL_DATA))
m.add_int(self.remote_chanid)
m.add_string(s[:size])
self.transport._send_user_message(m)
finally:
self.lock.release()
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 |
|
2006-11-05 00:12:40 |
Robey Pointer |
paramiko: assignee |
|
coldas57 |
|
2006-11-05 00:12:40 |
Robey Pointer |
paramiko: statusexplanation |
|
|
|
2006-11-11 01:08:09 |
Robey Pointer |
bug |
|
|
added attachment 'monkey.py' (test script) |
2007-02-11 02:32:53 |
Robey Pointer |
paramiko: status |
Unconfirmed |
Needs Info |
|
2008-08-27 15:51:15 |
Andreas Moog |
bug |
|
|
added subscriber Andreas Moog |
2008-08-27 15:51:15 |
Andreas Moog |
paramiko: status |
Incomplete |
Invalid |
|