Home Forums .NET libraries Xceed SFTP/FTP for .NET On transferring a big file over an http proxy, FtpClient throws System.NullReferenceException or Xceed.Ftp.FtpTimeoutException

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

    Hi,

    Our http proxy closes an ftp control port connection because no data is passing in the control port while a big file is being transferred on an ftp data port.

    Even though the data port completes the data transporting successfully, FtpClient throws System.NullReferenceException or Xceed.Ftp.FtpTimeoutException.

    The exception type is depends on the http proxy timeout setting value.

    In that case above, No exception is preferable and FTPClient trying to recover the control port connection. (Rebex.Ftp library also throws an exception) 

    I struggled against the issue by making sure that the big file was 100% transferred in the FileTransferStatusEventHandler and when the exception was thrown and 100% transferred, ignored it and reconnected to the ftp server.

    Any ideas? 

    Core FTP LE over our http proxy make it successful without no problem.

     

     [Xceed.Ftp  4.5.13060.10140 FtpClient Setting]

    FtpClient#SendFile method 

    Timeout = 600

    KeepAliveInterval = 0

    PassiveTransfer = true 

    RepresentationType =  RepresentationType.Binary

     [PC Environment]

    Xceed .Ftp 4.5.13060.10140

     VS2005 C#

    .NET Framework 2.0.50727 SP2 

    Windows XP Pro SP3  x86

     

     Here is the output log [http proxy timeout value is 180 seconds]

     ————————————————————

     2013-01-22 09:28:19,781 [INFO ] <–: 220 (vsFTPd 2.2.2)

     2013-01-22 09:28:19,796 [INFO ] –>: USER ********

     2013-01-22 09:28:19,812 [INFO ] <–: 331 Please specify the password.

     2013-01-22 09:28:19,812 [INFO ] –>: PASS ********

     2013-01-22 09:28:19,906 [INFO ] <–: 230 Login successful.

     2013-01-22 09:28:19,921 [INFO ] –>: CWD /

     2013-01-22 09:28:19,937 [INFO ] <–: 250 Directory successfully changed.

     2013-01-22 09:28:19,937 [INFO ] –>: TYPE A

     2013-01-22 09:28:19,953 [INFO ] <–: 200 Switching to ASCII mode.

     2013-01-22 09:28:19,953 [INFO ] –>: PASV

     2013-01-22 09:28:19,968 [INFO ] <–: 227 Entering Passive Mode (*,*,*,*,180,95).

     2013-01-22 09:28:19,968 [INFO ] –>: LIST 0001*

     2013-01-22 09:28:20,000 [INFO ] <–: 150 Here comes the directory listing.

     2013-01-22 09:28:20,171 [INFO ] <–: 226 Directory send OK.

     2013-01-22 09:28:20,250 [INFO ] <–: 0001 4,096 2013/01/11 17:50:00

     2013-01-22 09:28:20,250 [INFO ] –>: CWD 0001

     2013-01-22 09:28:20,265 [INFO ] <–: 250 Directory successfully changed.

     2013-01-22 09:28:20,281 [INFO ] –>: TYPE A

     2013-01-22 09:28:20,281 [INFO ] <–: 200 Switching to ASCII mode.

     2013-01-22 09:28:20,281 [INFO ] –>: PASV

     2013-01-22 09:28:20,296 [INFO ] <–: 227 Entering Passive Mode (*,*,*,*,207,93).

     2013-01-22 09:28:20,296 [INFO ] –>: LIST Send*

     2013-01-22 09:28:20,312 [INFO ] <–: 150 Here comes the directory listing.

     2013-01-22 09:28:20,500 [INFO ] <–: 226 Directory send OK.

     2013-01-22 09:28:20,500 [INFO ] <–: Send 4,096 2013/01/22 9:15:00

     2013-01-22 09:28:20,500 [INFO ] –>: CWD Send

     2013-01-22 09:28:20,515 [INFO ] <–: 250 Directory successfully changed.

     2013-01-22 09:28:20,515 [INFO ] –>: TYPE I

     2013-01-22 09:28:20,531 [INFO ] <–: 200 Switching to Binary mode.

     2013-01-22 09:28:20,531 [INFO ] –>: PASV

     2013-01-22 09:28:20,546 [INFO ] <–: 227 Entering Passive Mode (*,*,*,*,194,207).

     2013-01-22 09:28:20,562 [INFO ] –>: STOR ftp4j-1.7.2.zip

     2013-01-22 09:28:20,593 [INFO ] <–: 150 Ok to send data.

     2013-01-22 09:28:20,593 [INFO ] 8,192/475,090,051 bytes, 0%, elapsed:00:00:00.0781250

     2013-01-22 09:28:20,593 [INFO ] 16,384/475,090,051 bytes, 0%, elapsed:00:00:00.0781250

     …..

     2013-01-22 09:30:53,921 [INFO ] 475,090,051/475,090,051 bytes, 99%, elapsed:00:02:33.4062500

     2013-01-22 09:30:53,937 [INFO ] 475,090,051/475,090,051 bytes, 100%, elapsed:00:02:33.4218750

     2013-01-22 09:31:20,953 [WARN ] NullReferenceException has caught. 

     2013-01-22 09:31:20,968 [WARN ] Transferred: True

     2013-01-22 09:31:20,968 [ERROR] Object reference not set to an instance of an object.

     2013-01-22 09:31:20,968 [ERROR] System.NullReferenceException: Object reference not set to an instance of an object.

       at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)

       at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)

       at Xceed.Ftp.FtpClient.DoSendFile(FtpCommandChannel commandChannel, SendFileFtpCommandSequence sequence)

       at Xceed.Ftp.FtpClient.SendFile(String localFilename, String remoteFilename, Boolean append)

       at …..

     2013-01-22 09:31:20,968 [WARN ] Connected: False

     2013-01-22 09:31:20,968 [WARN ] Trying to reconnect…

     2013-01-22 09:31:21,156 [INFO ] <–: 220 (vsFTPd 2.2.2)

     2013-01-22 09:31:21,156 [INFO ] –>: USER ********

     2013-01-22 09:31:21,171 [INFO ] <–: 331 Please specify the password.

     2013-01-22 09:31:21,187 [INFO ] –>: PASS ********

     2013-01-22 09:31:21,265 [INFO ] <–: 230 Login successful.

     2013-01-22 09:31:21,281 [INFO ] –>: RNFR /0001/Send/ftp4j-1.7.2.zip

     2013-01-22 09:31:21,296 [INFO ] <–: 350 Ready for RNTO.

     2013-01-22 09:31:21,296 [INFO ] –>: RNTO /0001/Receive/ftp4j-1.7.2.zip

     2013-01-22 09:31:21,328 [INFO ] <–: 250 Rename successful.

     2013-01-22 09:31:21,359 [INFO ] –>: QUIT

     2013-01-22 09:31:21,375 [INFO ] <–: 221 Goodbye.

    ————————————————————

     
    Here is the output log [http proxy timeout value is 600 seconds] 
    In the case on Xceed.Ftp.FtpTimeoutException, FtpClient#Connected is true.
    So I tried to disconnect first.

    ———————————————————— 

     2013-01-22 12:09:50,625 [INFO ] 475,090,051/475,090,051 bytes, 99%, elapsed:00:02:36.3437500
     2013-01-22 12:09:50,625 [INFO ] 475,090,051/475,090,051 bytes, 100%, elapsed:00:02:36.3437500
     2013-01-22 12:10:20,515 [WARN ] FtpTimeoutException has caught.
     2013-01-22 12:10:20,531 [WARN ] Transferred: True
     2013-01-22 12:10:20,531 [ERROR] The FTP command execution timed-out.
     2013-01-22 12:10:20,531 [ERROR] 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.DoSendFile(FtpCommandChannel commandChannel, SendFileFtpCommandSequence sequence)
       at Xceed.Ftp.FtpClient.SendFile(String localFilename, String remoteFilename, Boolean append)
       at …..
     2013-01-22 12:10:20,531 [WARN ] Connected: True
     2013-01-22 12:10:20,531 [INFO ] –>: QUIT
     2013-01-22 12:10:50,546 [WARN ] Trying to reconnect…
     2013-01-22 12:10:50,671 [INFO ] <–: 220 (vsFTPd 2.2.2)
     2013-01-22 12:10:50,687 [INFO ] –>: USER ********
     2013-01-22 12:10:50,703 [INFO ] <–: 331 Please specify the password.
     2013-01-22 12:10:50,718 [INFO ] –>: PASS ********
     2013-01-22 12:10:50,796 [INFO ] <–: 230 Login successful.
     2013-01-22 12:10:50,812 [INFO ] –>: RNFR /0001/Send/ftp4j-1.7.2.zip
     2013-01-22 12:10:50,828 [INFO ] <–: 350 Ready for RNTO.
     2013-01-22 12:10:50,828 [INFO ] –>: RNTO /0001/Receive/ftp4j-1.7.2.zip
     2013-01-22 12:10:50,984 [INFO ] <–: 250 Rename successful.
     2013-01-22 12:10:51,125 [INFO ] –>: QUIT
     2013-01-22 12:10:51,140 [INFO ] <–: 221 Goodbye.
     ————————————————————

     

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

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Noriyuki,

    When you get the NullReferenceException can you “drill down” the inner exceptions and report them to us? This will allow us to know the real cause behind the exception you’re getting.

    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.

    You can attach the log to your post in the forums, or send it to us by
    email at support@xceed.com and include a reference to this forum post
    for reference. Thank you.

    Example (C#):

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

    Example (VB.NET):

       Try
          ‘ TODO: Code that causes an exception
       Catch exception As Exception
          ‘ Output some information about it
          Console.WriteLine(“–>{0}: {1}” & Constants.vbLf & “{2}”, exception.GetType().Name, exception.Message, exception.StackTrace)

          ‘ Fetch the inner exception
          exception = exception.InnerException

          ‘ While there is an exception
          Do While exception IsNot Nothing
             ‘ Output some information about it
             Console.WriteLine(“–>Inner exception: {0}: {1}” & Constants.vbLf & “{2}”, exception.GetType().Name, exception.Message, exception.StackTrace)

             ‘ Fetch the inner exception
             exception = exception.InnerException
          Loop
       End Try

     

     

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

    User (Old forums)
    Member
    Post count: 23064

    Hi, 

    > you “drill down” the inner exceptions 

    I drilled down the innner excepiton of the NullReferenceException, but it was null. 

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

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Noriyuki,

    I apologize for the delay.

    The lead developer will be sending you a special debug build by email in order to help us investigate further. We will then continue the discussion through email support.

     

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

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