You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error reading SSH protocol banner with paramiko with eventlet.spawn #337
I've got SSHException: Error reading SSH protocol banner exception when I tried to spawn ssh connection with eventlet. You can run the following code to repeat this error:
In the failure cases above, the CPU spikes during the 15 seconds until the banner timeout. During that time, paramiko is stuck in a loop between Packetizer._read_timeout() and ProxyCommand.recv():
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
-> x = self.__socket.recv(128)
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(428)_read_timeout()
-> except socket.timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(429)_read_timeout()
-> pass
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(436)_read_timeout()
-> if self.__closed:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(438)_read_timeout()
-> now = time.time()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(439)_read_timeout()
-> if now - start >= timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(422)_read_timeout()
-> while True:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(423)_read_timeout()
-> try:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
-> x = self.__socket.recv(128)
(Pdb)
--Call--
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(70)recv()
-> def recv(self, size):
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(78)recv()
-> try:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(79)recv()
-> start = datetime.now()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(80)recv()
-> while len(self.buffer) < size:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(81)recv()
-> if self.timeout is not None:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(82)recv()
-> elapsed = (datetime.now() - start).microseconds
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(83)recv()
-> timeout = self.timeout * 1000 * 1000 # to microseconds
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(84)recv()
-> if elapsed >= timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(85)recv()
-> raise socket.timeout()
(Pdb)
timeout: timeout()
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(85)recv()
-> raise socket.timeout()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(96)recv()
-> except socket.timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(97)recv()
-> raise # socket.timeout is a subclass of IOError
(Pdb)
--Return--
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(97)recv()->None
-> raise # socket.timeout is a subclass of IOError
(Pdb)
timeout: timeout()
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
-> x = self.__socket.recv(128)
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(428)_read_timeout()
-> except socket.timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(429)_read_timeout()
-> pass
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(436)_read_timeout()
-> if self.__closed:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(438)_read_timeout()
-> now = time.time()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(439)_read_timeout()
-> if now - start >= timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(422)_read_timeout()
-> while True:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(423)_read_timeout()
-> try:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
-> x = self.__socket.recv(128)
(Pdb)
--Call--
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(70)recv()
-> def recv(self, size):
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(78)recv()
-> try:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(79)recv()
-> start = datetime.now()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(80)recv()
-> while len(self.buffer) < size:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(81)recv()
-> if self.timeout is not None:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(82)recv()
-> elapsed = (datetime.now() - start).microseconds
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(83)recv()
-> timeout = self.timeout * 1000 * 1000 # to microseconds
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(84)recv()
-> if elapsed >= timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(85)recv()
-> raise socket.timeout()
(Pdb)
timeout: timeout()
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(85)recv()
-> raise socket.timeout()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(96)recv()
-> except socket.timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(97)recv()
-> raise # socket.timeout is a subclass of IOError
(Pdb)
--Return--
> /opt/heat/lib/python2.7/site-packages/paramiko/proxy.py(97)recv()->None
-> raise # socket.timeout is a subclass of IOError
(Pdb)
timeout: timeout()
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
-> x = self.__socket.recv(128)
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(428)_read_timeout()
-> except socket.timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(429)_read_timeout()
-> pass
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(436)_read_timeout()
-> if self.__closed:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(438)_read_timeout()
-> now = time.time()
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(439)_read_timeout()
-> if now - start >= timeout:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(422)_read_timeout()
-> while True:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(423)_read_timeout()
-> try:
(Pdb)
> /opt/heat/lib/python2.7/site-packages/paramiko/packet.py(424)_read_timeout()
[...]
No idea why I marked this as "needs investigation" before - we have never supported eventlet/greenlets :( That's not to say we wouldn't like to at some point but it's more of a feature request than an actual bug in my opinion.
I've opened a new proper feature ticket for this (so hopefully anybody searching will see that it's an unimplemented feature) and will link the two together for posterity.
Greenthread/eventlet/gevent has never really been supported by paramiko. Since paramiko is written to use threads as its concurrency model there might be several weird raises with how eventlet interacts with our threading model.
Activity
jasondunsmore commentedon Sep 11, 2014
I'm seeing this with when using a ProxyCommand socket. Paramiko hangs at this line until the timeout is reached, then I see the SSH protocol banner error:
https://github.com/paramiko/paramiko/blob/752507a29/paramiko/transport.py#L1700
This works:
This doesn't:
This also works:
If there are any workarounds, please let me know.
jasondunsmore commentedon Sep 11, 2014
In the failure cases above, the CPU spikes during the 15 seconds until the banner timeout. During that time, paramiko is stuck in a loop between
Packetizer._read_timeout()andProxyCommand.recv():bitprophet commentedon Sep 11, 2014
No idea why I marked this as "needs investigation" before - we have never supported eventlet/greenlets :( That's not to say we wouldn't like to at some point but it's more of a feature request than an actual bug in my opinion.
I've opened a new proper feature ticket for this (so hopefully anybody searching will see that it's an unimplemented feature) and will link the two together for posterity.
lndbrg commentedon Sep 11, 2014
Greenthread/eventlet/gevent has never really been supported by paramiko. Since paramiko is written to use threads as its concurrency model there might be several weird raises with how eventlet interacts with our threading model.
bitprophet commentedon Sep 11, 2014
See #389.