sshnet / sshnet/SSH.NET

SFTP DownloadFile hangs indefinitely when attempting to download moderate sized files

Offen
#733 16 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
4.4k
Forks
993
Ø Merge
9 T. 21 Std.
Gemergte PRs (30 T.)
1

Beschreibung

Hello,

I've been using SSH.NET for the past month for SFTP downloads and have been encountering an issue that I do not know how to work around. When calling the SftpClient DownloadFile method while attempting to download a file over about 100 KB the program will hang indefinitely even if the connection is forcibly closed by the remote host. This issue occurs inconsistently as sometimes I am able to download files without problem. After testing I have found this issue occurs with both the latest release available through NuGet and the 2020.0.0-beta1 release.

The code I am using to download files is listed below

foreach (string file in fileList)
{
    string filenameNoPath = file.Substring(file.LastIndexOf('/') + 1);
    string destination = outputPath + "\\" + filenameNoPath;
    using (Stream fileStream = File.OpenWrite(destination))
    {
        client.DownloadFile(file, fileStream);
        fileStream.Close();
    }
}

The platform I am using to test is Core SFTP Server (x64) installed on a Windows 10 Home machine. The connection between the testing platform and the client is my home LAN.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit SftpClient.DownloadFile und reproduziere den Hänger mit der Schleife aus dem Issue, einer Datei mit mehr als etwa 100 KB und Core SFTP Server (x64) unter Windows 10. Prüfe das Verhalten, wenn der Remote-Host die Verbindung schließt, und vergleiche es mit erfolgreichen kleineren oder intermittierenden Downloads. Als erledigt gilt die Aufgabe, wenn der gemeldete Download unter diesen Bedingungen nicht mehr unbegrenzt hängt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.