Skip to content

Excessive exception on TCP-probe #1682

Open
@clmbrdude

Description

@clmbrdude

We are running a paramiko sftp server in kubernetes.
To monitor that the server is up we have configured a TCP probe on port 22 to run every 10 seconds. Also we are running a load balancing nginx instance in front of the sftp servers, that will use a TCP probe the find out if the servers are alive.

Problem is that the logfiles are filled with exceptions looking like this:

paramiko.transport ERROR <host:4b4ade56cc9e> Exception: Error reading SSH protocol banner
paramiko.transport ERROR <host:4b4ade56cc9e> Traceback (most recent call last):
paramiko.transport ERROR <host:4b4ade56cc9e>   File "/usr/local/lib/python3.7/site-packages/paramiko/transport.py", line 2138, in _check_banner
paramiko.transport ERROR <host:4b4ade56cc9e>     buf = self.packetizer.readline(timeout)
paramiko.transport ERROR <host:4b4ade56cc9e>   File "/usr/local/lib/python3.7/site-packages/paramiko/packet.py", line 367, in readline
paramiko.transport ERROR <host:4b4ade56cc9e>     buf += self._read_timeout(timeout)
paramiko.transport ERROR <host:4b4ade56cc9e>   File "/usr/local/lib/python3.7/site-packages/paramiko/packet.py", line 563, in _read_timeout
paramiko.transport ERROR <host:4b4ade56cc9e>     raise EOFError()
paramiko.transport ERROR <host:4b4ade56cc9e> EOFError
paramiko.transport ERROR <host:4b4ade56cc9e> 
paramiko.transport ERROR <host:4b4ade56cc9e> During handling of the above exception, another exception occurred:
paramiko.transport ERROR <host:4b4ade56cc9e> 
paramiko.transport ERROR <host:4b4ade56cc9e> Traceback (most recent call last):
paramiko.transport ERROR <host:4b4ade56cc9e>   File "/usr/local/lib/python3.7/site-packages/paramiko/transport.py", line 1966, in run
paramiko.transport ERROR <host:4b4ade56cc9e>     self._check_banner()
paramiko.transport ERROR <host:4b4ade56cc9e>   File "/usr/local/lib/python3.7/site-packages/paramiko/transport.py", line 2143, in _check_banner
paramiko.transport ERROR <host:4b4ade56cc9e>     "Error reading SSH protocol banner" + str(e)
paramiko.transport ERROR <host:4b4ade56cc9e> paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
paramiko.transport ERROR <host:4b4ade56cc9e> 

It seems that the method _check_banner() will cause these exceptions to be raised if conecctions is dropped before a banner is sent.
The "easy" fix would be to catch and reraise the EOFError, i.e.

            except EOFError:
                raise

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions