sshnet / sshnet/SSH.NET

Zero length stream return during simultaneous downloads

Open
#1,740 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

On one of a servers DownloadFileAsync returns zero length output stream in concurrency scenario without throwing any exceptions.
The server uses virtual folder and some scripts configuration to move files from one folder to another after it was downloaded by client connection.
Files are non zero length. It reproduces ocasionally.
From logs I see this cases: 3 messages downloaded at 21:01:37.457, at 21:01:39 exception after checking for zero length stream written.
3 message downloaded at 2025-11-18 21:25:51.700, at 11/18/2025 21:25:52 exception after checking for zero length stream written.
SSH.NET for both version 2024.2.0, 2025.1.0 .Net 9.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing simultaneous DownloadFileAsync calls against the reported virtual-folder setup, including the scripts that move files after download. Compare behavior on SSH.NET 2024.2.0 and 2025.1.0 under .NET 9, using the supplied timestamps and zero-length stream check; done means the concurrency case is explained and no valid download silently returns an empty stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.