sshnet / sshnet/SSH.NET

ScpClient.Download hangs under some circumstances regardless OperationTimout set

Open
#255 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

ScpClient.Download hangs under some circumstances

       ScpClient scp = null;
       try
       {
       scp = new ScpClient(ip.ToString(), int.Parse(data.PortSSH), data.Login, data.Password);
       scp.OperationTimeout = new TimeSpan(0, 0, 10);
       scp.Connect();
       scp.Download(download, save);

There is probably some issue on server side, as scp on linux server ends like this:

[login@host ~]$ scp login@xxx.xxx.xxx.xxx:/file.exp ~/
login@xxx.xxx.xxx.xxx's password:
exec request failed on channel 0

This discussion can give you some more info, it seems to be related.
https://forum.mikrotik.com/viewtopic.php?t=104485
Server will be most probably updated, so I may not be able to try it again.

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 at the ScpClient.Connect and ScpClient.Download entry points and inspect how OperationTimeout is applied when the server returns "exec request failed on channel 0". The issue names no repository files or tests, so first reproduce the hang with a server exhibiting this response; done means the client no longer hangs and the timeout behavior is covered by an appropriate test.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.