Describe the bug
The _OpenSSH backend in async_backend.py raises an OSError when it encounters SSH warning messages about adding host keys to the known hosts file. This causes transport tasks to fail, resulting in calculation pausing.
When SSH connects to a new host for the first time, it outputs a warning message like:
Warning: Permanently added '[hostname]:port' (ED25519) to the list of known hosts.
The current implementation in path_exists method (lines 625-633) treats any stderr output as an error, causing it to raise an exception for these harmless warning messages.
Steps to reproduce
Steps to reproduce the behavior:
- Configure an AiiDA computer with
core.ssh_async transport and openssh backend
- Connect to a remote host that hasn't been added to the SSH known hosts file
- Submit a calculation that requires transport to the remote host
- Observe the transport task failing with
OSError containing the host key warning message
Expected behavior
The OpenSSH backend should ignore SSH warning messages about adding host keys to the known hosts file, as they are not actual errors and should not cause transport tasks to fail.
Your environment
- Operating system: Linux (Docker container)
- Python version: 3.10
- aiida-core version: 2.7.3 (or similar)
Other relevant software versions:
Additional context
The issue occurs because the path_exists method in async_backend.py checks for any stderr output and raises an exception if it finds any, without distinguishing between actual errors and harmless warnings. This is problematic because SSH often outputs warning messages that are not errors but provide useful information to the user.
The fix would be to modify the path_exists method to ignore specific SSH warning messages, such as those related to adding host keys to the known hosts file.
Describe the bug
The
_OpenSSHbackend inasync_backend.pyraises anOSErrorwhen it encounters SSH warning messages about adding host keys to the known hosts file. This causes transport tasks to fail, resulting in calculation pausing.When SSH connects to a new host for the first time, it outputs a warning message like:
The current implementation in
path_existsmethod (lines 625-633) treats any stderr output as an error, causing it to raise an exception for these harmless warning messages.Steps to reproduce
Steps to reproduce the behavior:
core.ssh_asynctransport andopensshbackendOSErrorcontaining the host key warning messageExpected behavior
The OpenSSH backend should ignore SSH warning messages about adding host keys to the known hosts file, as they are not actual errors and should not cause transport tasks to fail.
Your environment
Other relevant software versions:
Additional context
The issue occurs because the
path_existsmethod inasync_backend.pychecks for any stderr output and raises an exception if it finds any, without distinguishing between actual errors and harmless warnings. This is problematic because SSH often outputs warning messages that are not errors but provide useful information to the user.The fix would be to modify the
path_existsmethod to ignore specific SSH warning messages, such as those related to adding host keys to the known hosts file.