Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Very small files downloaded "successfully", but empty

Sort Posts: Previous Next
  •  05-13-2008, 6:10 PM Post no. 12229

    Very small files downloaded "successfully", but empty

    Hello,

     While evaluating the latest version of the FTP libary for .NET I came accross the following behaviour that can be simulated by following the steps down below.  Please let me know if there's a fix available for this issue -

     Problem:  Very small files (1 - 2 charactes, or 4 bytes - for instance) are randomly downloaded empty, w/o errors being generated.  The higher the connection speed to the FTP server, the higher the occurence rate.  For an FTP server part of the LAN - we get about 15% of the files empty

     How to reproduce the behaviour: (1) use a source FTP server with a high connection speed [I used FileZilla on a LAN server because I wanted to test implicit SSL]; (2) Have available on the FTP server several very small files, say 4 bytes each - we'll attempt to download them in a single session [I used 100 text files, each having just 2 characters as the body of the file] (3) download all these files locally, one at a time, by name - as part of the same session. You'll end up with about 15% of the files which are empty (size=0), and no errors raised on either end (server, or client).

    Here's the code that I used to simulate the behaviour.  Thanks for your help --

    class TestConsole

    {

    static void Main(string[] args)

    {

    FtpClient ftpSession = new FtpClient();

    ftpSession.TraceWriter = Console.Out;

    ftpSession.CertificateReceived += new CertificateReceivedEventHandler(ftpSession_CertificateReceived);

    int hostport = 990;

    ftpSession.Connect("your FTPS Server IP address", hostport, AuthenticationMethod.Tls, VerificationFlags.None, null);

    ftpSession.SendCustomCommand("PROT P");

    ftpSession.Login("your user name", "your password");

    ftpSession.ChangeCurrentFolder("upload");

    ftpSession.ListingParsers.Clear();

    ftpSession.ListingParsers.Add(new FtpUnixListingParser());

    FtpItemInfoList items = ftpSession.GetFolderContents();

    foreach (FtpItemInfo item in items)

    {

    if (item.Type == FtpItemType.File)

    {

    string dnloadRemoteName = item.Name + ".dload";

    string dnloadLocalName = "c:\\temp\\" + dnloadRemoteName;

    ftpSession.RenameFile(item.Name, dnloadRemoteName);

    ftpSession.ReceiveFile(dnloadRemoteName, dnloadLocalName);

    AbstractFile localFile = new DiskFile(dnloadLocalName);

    if (localFile.Size > 0)

    {

    localFile.Name = localFile.Name + ".txt";

    ftpSession.DeleteFile(dnloadRemoteName);

    }

    }

    }

     

    ftpSession.Disconnect();

    ftpSession.CertificateReceived -= new CertificateReceivedEventHandler(ftpSession_CertificateReceived);

    }

    static void ftpSession_CertificateReceived(object sender, CertificateReceivedEventArgs e)

    {

    e.Action = VerificationAction.Accept;

    }

    }

     

  •  05-14-2008, 12:13 PM Post no. 12261 in reply to 12229

    Re: Very small files downloaded "successfully", but empty

    Just to notify you that we are investigating the issue. We were able to reproduce the problem. As soon as we have new development, we will notify you.
    Charles Bérubé-Rémillard
    Technical Support
    Xceed Software Inc.
  •  05-14-2008, 12:57 PM Post no. 12263 in reply to 12261

    Re: Very small files downloaded "successfully", but empty

    Great, thanks Charles -

  •  05-20-2008, 1:03 PM Post no. 12387 in reply to 12261

    Re: Very small files downloaded "successfully", but empty

    Hi Charles,

     I was wondering if there's any chance to get this issue addressed within the next couple of days? 

    This will help us decide whether to wait for the fix, or look elsewhere

     Thanks very much,

    Leonard

  •  05-22-2008, 8:33 AM Post no. 12443 in reply to 12387

    Re: Very small files downloaded "successfully", but empty

    Hi Leonard,

        We are currently investigating the issue. We'll keep you informed as soon as we have more information.

    Thanks for your comments,


    Christian Nadeau
    Software Developer
    Xceed Software Inc.
  •  05-26-2008, 11:24 AM Post no. 12501 in reply to 12443

    Re: Very small files downloaded "successfully", but empty

    We have been able to identify the problem in the Secure layer of the Ftp component, but that at this time, we will not be able to correct it rapidly.  It is a problem that is deeply located in the core of the library, and is due to the fact that the library is asynchronous/multithreaded underneath, and very small files (<= 8k) cause a race condition.  Correcting this will require to make important changes to the way the library works.  This requires a thoughtful evaluation and an important investment of time and resources.

    The only workaround available at this time is to NOT use a secure connection when uploading small files.

    We will post back here when we have resolved the issue.


    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  06-16-2008, 12:30 PM Post no. 12999 in reply to 12501

    Re: Very small files downloaded "successfully", but empty

    Is there any time frame to this issue? This issue has caused us countless support calls with users of systems which use the FTP component and we have to resolve this as soon as possible. I appreciate the issues around development time, but frankly an FTP component that does not download files reliably is fundamentally not fit for purpose. We are using version 3.7.8125.15060 of the Xceed.Ftp component. Is there a work around in the meantime?

     

     

  •  06-17-2008, 3:26 PM Post no. 13028 in reply to 12999

    Re: Very small files downloaded "successfully", but empty

    We have other important releases around the corner for other products, and resources are not available to address this right now.

    Do not forget that this problem is for rather small files (<= 8k), and that is it only when using SSL/TLS.  So there are a couple of workarounds, which are not to use the secure connection for those files, or zip those files and send them as a unique file.


    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  06-18-2008, 6:28 AM Post no. 13050 in reply to 13028

    Re: Very small files downloaded "successfully", but empty

    Thank you for your response. Unfortunately, in this case SSL/TLS is mandatory and files are provided by a third party and there is no way to group, zip files etc. Although the incidences of files less than 8K is low, when it does happen, this issue is significant. I have had some measure of success with implementing a retry list of failed FTP downloads. Although there are still instances where the underlying FTP threads appear to hang and then eventually timeout. The biggest problem is that failed threads sometimes keep a handle to the zero byte file preventing a retry overwriting that file. I have tried calling Abort() on the ftpclient but this does not appear to release the lock.

    Is there anyway to ensure that the underlying threads are killed off before retrying a set of downloads? That would probably be a sufficient work around for us. Thanks for your help here.

    Regards,

    Steve 

     

     

     

  •  06-20-2008, 2:43 PM Post no. 13114 in reply to 13050

    Re: Very small files downloaded "successfully", but empty

    Unfortunately, it is not possible to kill those underlying thread directly.  I think the only solution here would be to dispose of the ftpclient and wait for the port to be closed by the OS on the local side, and possibly by the server on the ftp side, so that the handle on the file is released.
    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  06-23-2008, 11:40 AM Post no. 13150 in reply to 13114

    Re: Very small files downloaded "successfully", but empty

    Thanks for your help. We'll wait for the fix and just implement a retry in the meantime.

    Kind regards,

    Steve 

     

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.