Skip to content

SftpClient.IsConnect returns true even if session is closed. #1153

Closed
@anandgmenon

Description

@anandgmenon

This is similar to the discussion in #843

We have a connection pool implemented for the SftpClient and we reconnect whenever SftpClient.IsConnected() returns false.
However we have noticed issues where SftpClient.IsConnected() still returns true in case the server has closed the session and we eventually get the following error when using the client for any operation

System.InvalidOperationException: The session is not open. at Renci.SshNet.Common.AsyncResult.EndInvoke() at Renci.SshNet.SftpClient.EndListDirectory(IAsyncResult asyncResult)

Is this an expected behaviour? If not, can we try to implement the fix mentioned #843 or expose a method to determine if the session is open or not?

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