Got error "Failure" on ListDirectory

Aug 23, 2011 at 6:56 AM

Sorry to keep bugging you all.

I'm getting an ambiguous error "Failure" when calling ListDirectory. However, it's not all the time. It happens ironically on the 100th call to ListDirectory, with the previous 99 working okay.

Is this a setting in the SSH.NET library or a setting on the server that would be causing this to fail?

I always make a call to SendKeepAlive and check to make sure the connection to the server is valid before calling ListDirectory. Is this a setting on the server?

 

Thanks,

PasteyWhiteCoder

Coordinator
Aug 23, 2011 at 12:36 PM

Can you please download latest source version.

I just fixed this specific error recently.

 

Thanks,

Oleg

Aug 23, 2011 at 4:56 PM

I downloaded the new version and I'm still getting the same error at the same place in the code.

Coordinator
Aug 23, 2011 at 5:26 PM

Can you double check that in the version that you have there in InternalListDirectory method located in SftpClient class you have this method call at the end:

this._sftpSession.RequestClose(handle);

Thanks,

Oleg

Aug 23, 2011 at 5:42 PM

That line of code was not there. After adding it, I'm happy to say that it breaks that barrier.

Thanks for your help. I really appreciate it. I was using SharpSSH before this and your library is so much easier to use. Thanks for taking the time to write it.

Aug 23, 2011 at 5:59 PM

Okay, another problem:

My application hangs on

var index = EventWaitHandle.WaitAny(waitHandles, operationTimeout);

on DownloadFile. Thoughts?

Coordinator
Aug 23, 2011 at 6:19 PM

Yes,

 

Please download latest source code version from  the "Source code" tab as I have another bug that I fixed which has to do exactly with this problem.

Will try to release a new version soon, which will include all those fixes but for now you ca use latest version in the source, which is stable, I think.

 

Oleg

Aug 23, 2011 at 7:26 PM

I'm using the latest source code version from the Source Code tab (updated July 29th).

Coordinator
Aug 23, 2011 at 7:28 PM

I mean use this version 9631, updated last Monday.

Aug 23, 2011 at 8:12 PM

With the 9631 revision, the code gets stuck in a while loop during InternalDownloadFile.

while (data != null)
{
    output.Write(data, 0, data.Length);

    output.Flush();

    offset += (ulong)data.Length;

    //  Call callback to report number of bytes read
    if (asynchResult != null)
    {
        asynchResult.Update(offset);
    }

    data = this._sftpSession.RequestRead(handle, offset, this.BufferSize);
}

Coordinator
Aug 24, 2011 at 2:12 AM

Again, you not using the correct version, since in the latest version it should say:

while (data.Length > 0)

instead of :

while (data != null)

Oleg

Aug 24, 2011 at 8:27 PM

Sorry, still getting used to this site. Just found the "download" link on the check-ins page. Thought I had to go through and apply them one-by-one. O_O

My coworker always finds the bugs that I don't. I'll let you know if she runs into any problems.

Coordinator
Aug 24, 2011 at 8:32 PM

yea, no problem