Home Forums .NET libraries Xceed SFTP/FTP for .NET Increase the "timeout" for FtpClient.GetFolderContents()

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21424 |

    The directory that I’m executing this method on contains over 100K (100,000) files. It times-out while iterating over all of these files. I’ve updated my FtpClient.Timeout setting to 2 hours, but my job is still failing after ~900 seconds. Is there a different timeout property that I need to set, or do I need to set a KeepAliveInterval or something like that in order for this to continue iterating over the files in my directory?

     Here’s my stack trace information:

    Xceed.Ftp.FtpTimeoutException: The FTP command execution timed-out.
       at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
       at Xceed.Ftp.FtpClient.DoGetFolderContents(FtpCommandChannel commandChannel, ListFtpCommand listCommand)
       at Xceed.Ftp.FtpClient.GetFolderContents()
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl) in C:\Vault\StandAloneApplications\MaintenanceApplications\MVST.FTPArchiveUtility\Program.cs:line 193
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl) in C:\Vault\StandAloneApplications\MaintenanceApplications\MVST.FTPArchiveUtility\Program.cs:line 205
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl) in C:\Vault\StandAloneApplications\MaintenanceApplications\MVST.FTPArchiveUtility\Program.cs:line 205
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocations(FTPWatchLocation[] watchLocations) in C:\Vault\StandAloneApplications\MaintenanceApplications\MVST.FTPArchiveUtility\Program.cs:line 162

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 2934 views)

    User (Old forums)
    Member
    Post count: 23064

    By the way, I have a support account…

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 576 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ganders,

    The email you are using to post on the forums is not linked with an active support subscription, as otherwise a support ticket would have been automatically generated when you created the forum thread. If you do indeed have a support subscription and want to take advantage of it, we strongly recommend that you send your questions by email instead of posting them the forums.

    In regards to your question, we would need the FTP log as well as the complete exception information with inner exception. Please send them by email to support@xceed.com and include a link to this forum thread for reference. Thank you.

    For the FTP log, you have to set the TraceWritter property:

      myFtpClient.TraceWriter = new StreamWriter( @”D:\Log\XceedFtp.log”, true );

    For the complete exception, please “drill down” the inner exceptions and report them to us. Each System.Exception object contains a InnerException property. You can loop on each inner exception, taking note of each exception along the way until InnerException is null.

    For example:

      try
      {
        // TODO: Code that causes an exception
      }
      catch( Exception exception )
      {
        // Output some information about it
        Console.WriteLine( “–>{0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );

        // Fetch the inner exception
        exception = exception.InnerException;

        // While there is an exception
        while( exception != null )
        {
          // Output some information about it
          Console.WriteLine( “–>Inner exception: {0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );

          // Fetch the inner exception
          exception = exception.InnerException;
        }
      }

     

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 334 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Diane, here’s my sample code, and log/stack trace information (basically the same as above). As you can see, there is no inner exception information being passed.

      Error: .: The specified network name is no longer available.  (reply code 550)
     Stack Trace:    at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
       at Xceed.Ftp.FtpClient.DoGetFolderContents(FtpCommandChannel commandChannel, ListFtpCommand listCommand)
       at Xceed.Ftp.FtpClient.GetFolderContents()
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocations(FTPWatchLocation[] watchLocations)

    catch (Exception ex)

    {

    Logger.InsertReject(

    String.Format(“Error processing watch location: {0} Path: {1}”, wl.LocationName, wl.LocationPath), ex.ToString());

    Console.WriteLine(“An error occurred processing watch location name \”{0}\” for path \”{1}\””, wl.LocationName, wl.LocationPath);

    Console.WriteLine(“\tError: {0}\r\n\tStack Trace: {1}”, ex.Message, ex.StackTrace);

    Exception e = ex.InnerException;

    while (e != null)

    {

    Console.WriteLine(“———————————————————————————————————–“);

    Console.WriteLine(String.Format(“Message: {0}\r\nStack Trace: {1}”, e.Message, e.StackTrace));

    e = e.InnerException;

    }

    }

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 361 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ganders,

    Could you also provide us with the Log that the TraceWriter generated? Thank you.

     

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 285 views)

    User (Old forums)
    Member
    Post count: 23064

    My bad, this is an old program, where I’ve converted most other jobs to automatically set the TraceWriter to Console.Out, but apparently forgot/missed this job.

     Let me re-run with the Xceed logging built in…

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 253 views)

    User (Old forums)
    Member
    Post count: 23064

    Data connection established with 172.28.132.71:1237 on 3/5/2013 @ 1:19:46 PM
    < 125 Data connection already open; Transfer starting.
    < 226 Transfer complete.
    > CWD Xml
    < 250 CWD command successful.
    > PWD
    < 257 “/ltstorage/MCSPrint/MCSTempFiles/InvoiceReportFilePath/MCSPrint/MCSPrint/MCSTempFiles/Transmittals/01-20-2013/SummaryReport/Xml” is current directory.
    > TYPE A
    < 200 Type set to A.
    > PASV
    < 227 Entering Passive Mode (172,28,132,71,4,215).
    > LIST
    Data connection established with 172.28.132.71:1239 on 3/5/2013 @ 1:19:46 PM
    < 125 Data connection already open; Transfer starting.
    < 226 Transfer complete.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CDUP
    < 250 CWD command successful.
    > CWD Pdffile
    < 250 CWD command successful.
    > PWD
    < 257 “/ltstorage/MCSPrint/MCSTempFiles/InvoiceReportFilePath/Pdffile” is current directory.
    > TYPE A
    < 200 Type set to A.
    > PASV
    < 227 Entering Passive Mode (172,28,132,71,4,216).
    > LIST
    Data connection established with 172.28.132.71:1240 on 3/5/2013 @ 1:19:46 PM
    < 125 Data connection already open; Transfer starting.
    < 226 Transfer complete.
    > CDUP
    < 250 CWD command successful.
    > CWD Xmlfile
    < 250 CWD command successful.
    > PWD
    < 257 “/ltstorage/MCSPrint/MCSTempFiles/InvoiceReportFilePath/Xmlfile” is current directory.
    > TYPE A
    < 200 Type set to A.
    > PASV
    < 227 Entering Passive Mode (172,28,132,71,4,246).
    > LIST
    Data connection established with 172.28.132.71:1270 on 3/5/2013 @ 1:20:21 PM
    < 125 Data connection already open; Transfer starting.
    An error occurred processing watch location name “Archive” for path “MCSPrint”
     Error: The FTP command execution timed-out.
     Stack Trace:    at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
       at Xceed.Ftp.FtpClient.DoGetFolderContents(FtpCommandChannel commandChannel, ListFtpCommand listCommand)
       at Xceed.Ftp.FtpClient.GetFolderContents()
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocation(FtpClient ftpClient, FTPWatchLocation wl)
       at MVST.FTPArchiveUtility.Program.ProcessWatchLocations(FTPWatchLocation[] watchLocations)
    > QUIT
    Disconnected from 172.28.132.71:21 on 3/5/2013 @ 1:21:21 PM

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 436 views)

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi Ganders,

    What version of http://ftp.net are you using?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Fawzi [Xceed] (had 392 views)

    User (Old forums)
    Member
    Post count: 23064

    [quote user=”Fawzi [Xceed]”]

    Hi Ganders,

    What version of http://ftp.net are you using?

    [/quote]

    Xceed.Ftp.dll

    File/Product version 4.4.12556.9330

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 671 views)

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi Ganders,

     Can you try setting the KeepAliveInterval to 45
    seconds?

    http://ftp.KeepAliveInterval = 45;

    KeepAliveInterval usually
    isn’t useful but it’s worth testing with it to see if it’s the server who stops
    sending data or if something goes wrong with the component.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Fawzi [Xceed] (had 346 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes, but I won’t be able to implement the change until mid-April.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 468 views)

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi Ganders,

    As soon as you test it, let us know what are the results and we will be happy to do further investigation.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Fawzi [Xceed] (had 2325 views)

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.