Subject: FTP Transfer locks up and blocks
Date: 2015-01-30 15:14:18
From: John Mininger
Source: ftp-transfer-locks-blocks

We've written a windows service that transfers files to a remote server. Unfortunately, the FTP component has experienced a blocking, non-erroring lockup during the transfer process for over 16 hours until the service process was manually killed and restarted. The application processor usage was at 20% or so during this while nothing was happening. Other periodic tasks the service also handles were not effected and continued to run. The Client.Progress event is only configured to log (filtered on) TransferState.Uploading and was not logging anything during this time. Logging around the upload call indicates that the lockup occured during a multi-threaded FTP upload to the remote server. Here's the code we used to upload, with the line surrounded by logging indicating where the lockup occured. This code is never multi-threaded (ie, only one instance will ever run at a time), it's only rescheduled after completion.

[code lang='c#']
client = new Ftp();
client.Progress += ftp_client_Progress; client.Connect(FTPEndpoint, FTPPort, FtpSecurityMode.Implicit);
client.Authenticate(FTPUserName, FTPPassword);
var options = new TransferOptions(false, RecursionMode.None, false, (SearchCondition)null, FileExistsResolveAction.Overwrite, SymlinksResolveAction.Confirm);
options.RetainFileList = true;
log.Debug(String.Format("FTP Upload Starting for {0} files.", filestouploadArray.Length)); // Last logging event.
FileSystemTransferStatistics transferstats = client.UploadFiles(filestouploadArray, FTPPath, options, 10, true); // Called and never returned.
log.Debug("FTP Upload Finished."); // Never reached.

What can we do to correct this undesirable behavior? Exception handling was built into the service but never reached (no exception thrown), and in theory the timeout (default or specified) should have been reached many times over. Is this a known issue with the FTP component? The only solution we can think of is to monitor the FTP process via. seperate thread and if there's a lack of progress actually programatically KILL the entire service process (to release all FTP resources) and have the server restart it - this obviously isn't ideal. Is there something else we could do or should do differently?

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index