Skip to content

ScpClient.Download hangs under some circumstances regardless OperationTimout set #255

@danvac

Description

@danvac

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.

Activity

danvac

danvac commented on Jul 14, 2017

@danvac
Author

Tested with SSH.NET-2016.1.0-beta1-bin and also my build from master and tag 2016.0.0.

danvac

danvac commented on Aug 18, 2017

@danvac
Author

I see this report makes not much sense. After #256 will be fixed I will try to update device to version causing ScpClient.Download to hang.

added this to the 2017.0.0 milestone on Aug 19, 2017
ahmadalli

ahmadalli commented on Jan 8, 2018

@ahmadalli

I'm facing a similar issue: I have an iPad connected to my device using USB and I'm mapping it's 22 port using iproxy. I logged downloading event output and found out that download stops working after sometime (and the event won't get fired from that point on)

ahmadalli

ahmadalli commented on Jan 8, 2018

@ahmadalli

I don't have the path problem. I'm changing the filename to something like 123.file

DsAekb

DsAekb commented on Feb 5, 2018

@DsAekb

I encountered this issue and I think I figured it out.
So why it hangs? It hangs on reading the input, but if there was some error on server side, nothing comes through channel.DataReceived and nothing is being written into input. It is here .
The errors are being received as extended data, so I add channe.ExtendedDataReceived += (sender, e) => input.Write(e.data, 0, e.Data.Length); and all the errors were thrown back successfully.
Off course it doesn't fix timeout issue when really no data is received from the server, but at least it doesn't hangs when errors occur.

drieseng

drieseng commented on Feb 5, 2018

@drieseng
Member

@DsAekb We indeed have two issues here: we do not processes any data received via ExtendedDataReceived (stderr), and we do not time out when no data is received at all.

removed this from the 2017.0.0 milestone on Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @drieseng@ahmadalli@danvac@DsAekb

        Issue actions

          ScpClient.Download hangs under some circumstances regardless OperationTimout set · Issue #255 · sshnet/SSH.NET