Welcome to the Xceed Community | Help
Community Search  
More Search Options

Increase the "timeout" for FtpClient.GetFolderContents()

Sort Posts: Previous Next
  •  02-28-2013, 3:48 PM Post no. 33138

    Increase the "timeout" for FtpClient.GetFolderContents()

    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

  •  03-01-2013, 12:12 PM Post no. 33140 in reply to 33138

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    By the way, I have a support account...
  •  03-04-2013, 3:45 PM Post no. 33145 in reply to 33140

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    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;
        }
      }

     


    Diane Lafontaine
    Developer Technical Support
    Xceed Software Inc.

    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!
  •  03-05-2013, 12:28 PM Post no. 33152 in reply to 33145

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    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;

    }

    }

  •  03-05-2013, 2:05 PM Post no. 33155 in reply to 33152

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Hi ganders,

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

     


    Diane Lafontaine
    Developer Technical Support
    Xceed Software Inc.

    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!
  •  03-05-2013, 2:13 PM Post no. 33156 in reply to 33145

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    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...

  •  03-05-2013, 5:18 PM Post no. 33157 in reply to 33156

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    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
  •  03-08-2013, 11:13 AM Post no. 33166 in reply to 33157

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Hi Ganders,

    What version of ftp.net are you using?


    Fawzi Bablli
    Developer Technical Support
    Xceed Software Inc.
  •  03-08-2013, 11:21 AM Post no. 33167 in reply to 33166

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Fawzi [Xceed]:

    Hi Ganders,

    What version of ftp.net are you using?

    Xceed.Ftp.dll

    File/Product version 4.4.12556.9330

  •  03-20-2013, 3:56 PM Post no. 33199 in reply to 33167

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Hi Ganders,

     Can you try setting the KeepAliveInterval to 45 seconds?

    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.


    Fawzi Bablli
    Developer Technical Support
    Xceed Software Inc.
  •  03-20-2013, 4:05 PM Post no. 33200 in reply to 33199

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Yes, but I won't be able to implement the change until mid-April.
  •  03-21-2013, 10:07 AM Post no. 33201 in reply to 33200

    Re: Increase the "timeout" for FtpClient.GetFolderContents()

    Hi Ganders,

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


    Fawzi Bablli
    Developer Technical Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.