Skip to content

OpenSSH backend raises OSError for SSH host key warning messages #7311

@stillfast

Description

@stillfast

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:

  1. Configure an AiiDA computer with core.ssh_async transport and openssh backend
  2. Connect to a remote host that hasn't been added to the SSH known hosts file
  3. Submit a calculation that requires transport to the remote host
  4. 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:

  • OpenSSH client: 8.8+

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions