Skip to content

Invalid handle for simultaneous downloads. #1731

@m0a0k0s

Description

@m0a0k0s

I’m using a single SftpClient to download multiple files simultaneously. On one of a servers, I get "Invalid handle" error from time to time.
SSH.NET version 2024.2.0, .Net 9.
In connection logs I only see this version: Remote version: SSH-2.0-2.0

			"HResult": -2146233088,
			"Message": "Invalid handle.",
			"Source": "Renci.SshNet",
			"StackTrace": "   at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)\r\n   at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback)\r\n   at Renci.SshNet.SftpClient.<>c__DisplayClass56_0.<BeginUploadFile>b__0()\r\n--- End of stack trace from previous location ---\r\n   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location ---\r\n
			"TargetSite": "Void RequestClose(Byte[])",
			"Type": "Renci.SshNet.Common.SshException"

   at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)
   at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback)
   at Renci.SshNet.SftpClient.<>c__DisplayClass56_0.<BeginUploadFile>b__0()
--- End of stack trace from previous location ---
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)

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