Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH timeout on transport when running pytest in parallel #6647

Open
unkcpz opened this issue Nov 30, 2024 · 0 comments
Open

SSH timeout on transport when running pytest in parallel #6647

unkcpz opened this issue Nov 30, 2024 · 0 comments
Labels

Comments

@unkcpz
Copy link
Member

unkcpz commented Nov 30, 2024

After #6620, the following exception may raised randomly in my workstation when running pytest with 32 cores in parallel. This require more investigation to avoid that the tests not randomly failed in GH CI.
The problem might be that in my workstation sshd configuration there is some setup to prevent too many ssh connections.

ERROR    aiida.transport.SshTransport:ssh.py:500 Error connecting to 'localhost' through SSH: [SshTransport] Error reading SSH protocol banner, connect_args were: {'timeout': 30}
___________________________________________________________________________________________________________________________________________________________________ test_proxy_jump ___________________________________________________________________________________________________________________________________________________________________
[gw6] linux -- Python 3.10.12 /home/jyu/venv/aiida-core-dev/bin/python3

self = <paramiko.Transport at 0xce709ed0 (unconnected)>

    def _check_banner(self):
        # this is slow, but we only have to do it once
        for i in range(100):
            # give them 15 seconds for the first line, then just 2 seconds
            # each additional line.  (some sites have very high latency.)
            if i == 0:
                timeout = self.banner_timeout
            else:
                timeout = 2
            try:
>               buf = self.packetizer.readline(timeout)

../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py:2369: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/packet.py:395: in readline
    buf += self._read_timeout(timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <paramiko.packet.Packetizer object at 0x7f07d4d8e4d0>, timeout = 2

    def _read_timeout(self, timeout):
        start = time.time()
        while True:
            try:
                x = self.__socket.recv(128)
                if len(x) == 0:
>                   raise EOFError()
E                   EOFError

../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/packet.py:665: EOFError

During handling of the above exception, another exception occurred:

    def test_proxy_jump():
        """Test the connection with a proxy jump or several"""
>       with SshTransport(
            machine='localhost', proxy_jump='localhost', timeout=30, load_system_host_keys=True, key_policy='AutoAddPolicy'
        ):

tests/transports/test_ssh.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/aiida/transports/transport.py:131: in __enter__
    self.open()
src/aiida/transports/plugins/ssh.py:480: in open
    proxy_client.connect(proxy['host'], **proxy_connargs)
../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/client.py:451: in connect
    t.start_client(timeout=timeout)
../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py:773: in start_client
    raise e
../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py:2185: in run
    self._check_banner()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <paramiko.Transport at 0xce709ed0 (unconnected)>

    def _check_banner(self):
        # this is slow, but we only have to do it once
        for i in range(100):
            # give them 15 seconds for the first line, then just 2 seconds
            # each additional line.  (some sites have very high latency.)
            if i == 0:
                timeout = self.banner_timeout
            else:
                timeout = 2
            try:
                buf = self.packetizer.readline(timeout)
            except ProxyCommandFailure:
                raise
            except Exception as e:
>               raise SSHException(
                    "Error reading SSH protocol banner" + str(e)
                )
E               paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

../../../venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py:2373: SSHException
---------------------------------------------------------------------------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------------------------------------------------------------------------
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] Exception (client): Error reading SSH protocol banner
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] Traceback (most recent call last):
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]   File "/home/jyu/venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py", line 2369, in _check_banner
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]     buf = self.packetizer.readline(timeout)
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]   File "/home/jyu/venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/packet.py", line 395, in readline
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]     buf += self._read_timeout(timeout)
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]   File "/home/jyu/venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/packet.py", line 665, in _read_timeout
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]     raise EOFError()
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] EOFError
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] 
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] During handling of the above exception, another exception occurred:
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] 
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] Traceback (most recent call last):
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]   File "/home/jyu/venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py", line 2185, in run
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]     self._check_banner()
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]   File "/home/jyu/venv/aiida-core-dev/lib/python3.10/site-packages/paramiko/transport.py", line 2373, in _check_banner
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR]     raise SSHException(
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
11/29/2024 05:03:08 PM <3242154> paramiko.transport: [ERROR] 
11/29/2024 05:03:08 PM <3242154> aiida.transport.SshTransport: [ERROR] Error connecting to proxy 'localhost' through SSH: [SshTransport] Error reading SSH protocol banner, connect_args were: {'timeout': 30}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant