Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent issues during long running operations #253

Closed
bavya-bal opened this issue Dec 11, 2017 · 3 comments
Closed

Intermittent issues during long running operations #253

bavya-bal opened this issue Dec 11, 2017 · 3 comments

Comments

@bavya-bal
Copy link

bavya-bal commented Dec 11, 2017

Computer OS: Windows 10

I was using Fluent FTP to connect to the FTP server and download the data. I created a scheduler with this dll which download the data from FTP on a particular time in a day. This was working fine. But recently I am getting issues to fetch the data from the FTP. If I try the same while debugging through the code, I can fetch the data. That means the issue is not consistent. Sometimes, it connect and sometimes its not. That also not all folder, some folder is not able to download. Following are the different kinds of error I am getting. (The error happens in following scenarios)

  1. While checking the directory exists in ftp s server (Sometime issue happens here for some folder)
  2. List the files inside a directory from FTP server (Sometime issue happens here for some folder)
  3. Downloading the files from FTP server. (Sometime issue happens here for some folder)

But the same folder if I debug through the code and try, it will download.

Following are the different types of error I am getting.>

Logs :

System.TimeoutException: Timed out trying to read data from the socket stream!

   at FluentFTP.FtpSocketStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at FluentFTP.FtpSocketStream.ReadLine(Encoding encoding)
   at FluentFTP.FtpClient.GetReply()
   at FluentFTP.FtpClient.Execute(String command)
   at FluentFTP.FtpClient.GetWorkingDirectory()
   at FluentFTP.FtpClient.DirectoryExists(String path)

Authentication failed because the remote party has closed the transport stream.

   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
   at FluentFTP.FtpSocketStream.ActivateEncryption(String targethost, X509CertificateCollection clientCerts, SslProtocols sslProtocols)
   at FluentFTP.FtpClient.OpenPassiveDataStream(FtpDataConnectionType type, String command, Int64 restart)
   at FluentFTP.FtpClient.OpenDataStream(String command, Int64 restart)
   at FluentFTP.FtpClient.GetListing(String path, FtpListOption options)
   at FluentFTP.FtpClient.GetListing(String path)

FluentFTP.FtpCommandException: The specified network name is no longer available.

   at FluentFTP.FtpClient.GetWorkingDirectory()
   at FluentFTP.FtpClient.DirectoryExists(String path)

FluentFTP.FtpException: Failed to get the EPSV port from: Type set to I.

   at FluentFTP.FtpClient.OpenPassiveDataStream(FtpDataConnectionType type, String command, Int64 restart)
   at FluentFTP.FtpClient.OpenDataStream(String command, Int64 restart)
   at FluentFTP.FtpClient.GetListing(String path, FtpListOption options)
   at FluentFTP.FtpClient.GetListing(String path)
@robinrodricks
Copy link
Owner

For now just use a try/catch, and if you have any issue then disconnect and reconnect to the server.

@robinrodricks
Copy link
Owner

Please note if you are using a single FTP client across multiple threads it can give issues, ie, if one command is not finished executing and another thread requests it to process a second command. Recommended way is to create an FTP client instance inside the worker/thread and then disconnect when done.

@robinrodricks robinrodricks changed the title Fluent FTP issue Intermittent issues during long running operations Dec 21, 2017
@robinrodricks
Copy link
Owner

@bavya-bal Can you check the latest release and report back which errors you are still getting? We've had many fixes and improvements since this was posted. Also remember to use high level API like UploadFile/UploadDirectory rather than implementing it using stream API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants