FluentFTP: when upload big file(11g db backup file), timed out trying to read data from the socket stream!
**FTP OS: winserver2016
**FTP Server:filezilla0.9.60
**Computer OS:winserver 2012
it doesn’t happen when upload small file. when upload a big(test on 200mb & 10gb) db backup file, client.UploadFile(localFullFilePath, ftpFullPath) method report a timeout exception.The Error is "Timed out trying to read data from the socket stream! " the wield thing is the db file is actual uploaded, i check the file size in ftp is right(but not check the file content). so i think may be after upload big file, the flutent ftp does something read, which cause this error.
FluentFTP.FtpException: Error while uploading the file to the server. See InnerException for more info. —> System.TimeoutException: Timed out trying to read data from the socket stream!
在 FluentFTP.FtpSocketStream.Read(Byte[] buffer, Int32 offset, Int32 count)
在 FluentFTP.FtpSocketStream.ReadLine(Encoding encoding)
在 FluentFTP.FtpClient.GetReply()
在 FluentFTP.FtpClient.UploadFileInternal(Stream fileData, String remotePath, Boolean createRemoteDir, FtpExists existsMode, Boolean fileExists, Boolean fileExistsKnown, IProgress1 progress) --- 内部异常堆栈跟踪的结尾 --- 在 FluentFTP.FtpClient.UploadFileInternal(Stream fileData, String remotePath, Boolean createRemoteDir, FtpExists existsMode, Boolean fileExists, Boolean fileExistsKnown, IProgress1 progress)
在 FluentFTP.FtpClient.UploadFileFromFile(String localPath, String remotePath, Boolean createRemoteDir, FtpExists existsMode, Boolean fileExists, Boolean fileExistsKnown, FtpVerify verifyOptions, IProgress1 progress) 在 FluentFTP.FtpClient.UploadFile(String localPath, String remotePath, FtpExists existsMode, Boolean createRemoteDir, FtpVerify verifyOptions, IProgress1 progress)
(000001)2019/3/28 12:50:03 - scims (192.168.163.1)> OPTS UTF8 ON (000001)2019/3/28 12:50:03 - scims (192.168.163.1)> 202 UTF8 mode is always enabled. No need to send this command. (000001)2019/3/28 12:50:03 - scims (192.168.163.1)> SYST (000001)2019/3/28 12:50:03 - scims (192.168.163.1)> 215 UNIX emulated by FileZilla (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> PWD (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> 257 “/” is current directory. (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> SIZE /r2012.jpg (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> 550 File not found (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> TYPE I (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> 200 Type set to I (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> EPSV (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> 229 Entering Extended Passive Mode (|||61165|) (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> STOR r2012.jpg (000001)2019/3/28 12:50:07 - scims (192.168.163.1)> 150 Opening data channel for file upload to server of “/r2012.jpg” (000001)2019/3/28 12:54:48 - scims (192.168.163.1)> disconnected. (000001)2019/3/28 12:54:48 - scims (192.168.163.1)> 226 Successfully transferred “/r2012.jpg” (000001)2019/3/28 12:54:48 - scims (192.168.163.1)> could not send reply, disconnected.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 34 (8 by maintainers)
Commits related to this issue
- #387 support for NoopInterval for keeping control socket alive during file transfers — committed to aliquid/FluentFTP by deleted user 4 years ago
- #387 exhaust NOOP responses also after 226 Transfer complete — committed to aliquid/FluentFTP by deleted user 4 years ago
- Merge pull request #507 from aliquid/features/387-NoopInterval-take2 #387 exhaust NOOP responses also after 226 Transfer complete — committed to robinrodricks/FluentFTP by robinrodricks 4 years ago
I solved it this way…
Hi.
I updated to FluentFTP 28.0.2 from NuGet.
I downloaded a 3.46 GB file, but still received the same exception:
Thank you.
I migrated my code from
System.Net.FtpWebRequesttoFluentFTP, thinking it would solve this issue. I get this error when downloading large files. I took the suggestion from https://stackoverflow.com/a/48983508/90287.I recommend tryingclient.SocketKeepAlive = true;to see if that resolves the issue.Here are the code comments for
DataConnectionType:The log in the original post indicated that the client connected using
EPSV.Someone indicated that updating their FileZilla server resolved the issue.
Thank you.
Edit Setting
client.SocketKeepAlive = true;did not resolve the issue.I also tried setting
client.ReadTimeout = -1;andclient.ReadTimeout = Int32.MaxValue;but then the download method didn’t return after the file was downloaded.@robinrodricks, that worked! 🎉
FluentFTP 29.0.3 no longer throws a TimeoutException when downloading a large file (3.53 GB).
Thank you very much! 😃
@icnocop Check this:
https://www.nuget.org/packages/FluentFTP/29.0.3
@icnocop @robinrodricks Test finished: I have a upload method inside a .dll created for me, the first StackTrace is the Main method which I call the upload method. The 2nd Stacktrace is the main interest:
StackTrace
1. In Main.cs
One or more errors occurred. (Error while uploading the file to the server. See InnerException for more info.)at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Aleiser_ECS_Gral_Function_Test.Program.Main(String[] args) in D:\Documents\Visual Studio 2019\Projects\Aleiser ECS Gral Function Test\Main.cs:line 392. This exception has an InnerException that is the StackTrace that throws upload method:
Timed out trying to read data from the socket stream! | System.Exception {System.TimeoutException}at FluentFTP.FtpSocketStream.<ReadAsync>d__68.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at FluentFTP.FtpSocketStream.<ReadLineAsync>d__71.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at FluentFTP.FtpClient.<GetReplyAsync>d__179.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at FluentFTP.FtpClient.<UploadFileInternalAsync>d__153.MoveNext()InnerException 1: FtpException: Error while uploading the file to the server. See InnerException for more info.
InnerException 2: TimeoutException: Timed out trying to read data from the socket stream!
Code:
Main.cs
Upload method:
I hope this will guide to a solution.
Test finished:
Sorry, the problem about TimeoutException still exists 😦 @robinrodricks
Still exist
@stefanolazzarato thanks for this fix, I finally understood the problem! I’ve attempted to absorb all TimeoutExceptions during upload/download if the file is fully transferred in the latest version https://www.nuget.org/packages/FluentFTP/27.1.4
@stefanolazzarato @wjchristenson2 @icnocop @nicojmb @luchunminglu Can everyone test the latest version and see if you are still getting those pesky errors?