FluentFTP: Incorrect retry actions after transfer connection drops because server reports too long file size
FTP Server OS: Apache FtpServer
Client Computer OS: Ubuntu (amazon linux 2)
FluentFTP Version: 42.0
Framework: .NET 6
It is working very few time under Ubuntu, but under Windows I got a file with double or 3x size.
Logs :
# AutoConnect()
# AutoDetect(True, False)
# ConnectAsync()
Status: FluentFTP 42.0.0.0
Status: Connecting to *.*.*.*:21
Status: Waiting for a response
Response: 220 Service ready for new user.
Command: AUTH TLS
Status: Waiting for response to: AUTH TLS
Response: 431 Service is unavailable.
Command: USER ****
Status: Waiting for response to: USER ****
Response: 331 User name okay, need password for ****.
Command: PASS ***
Status: Waiting for response to: PASS ***
Response: 230 User logged in, proceed.
Command: FEAT
Status: Waiting for response to: FEAT
Response: 211-Extensions supported
Response: SIZE
Response: MDTM
Response: REST STREAM
Response: LANG en;zh-tw;ja;is
Response: MLST Size;Modify;Type;Perm
Response: AUTH SSL
Response: AUTH TLS
Response: MODE Z
Response: UTF8
Response: TVFS
Response: MD5
Response: MMD5
Response: MFMT
Response: 211 End
Status: Text encoding: System.Text.UTF8Encoding+UTF8EncodingSealed
Command: OPTS UTF8 ON
Status: Waiting for response to: OPTS UTF8 ON
Response: 200 Command OPTS okay.
Command: SYST
Status: Waiting for response to: SYST
Response: 215 UNIX Type: Apache FtpServer
Status: Listing parser set to: Machine
# GetFileSize("****.txt.gz", -1)
Command: SIZE ****.txt.gz
Status: Waiting for response to: SIZE ****.txt.gz
Response: 213 85049263
# GetModifiedTime("****.txt.gz")
Command: MDTM ****.txt.gz
Status: Waiting for response to: MDTM ****.txt.gz
Response: 213 20221115094042.667
Downloading file to:
# DownloadFile("/tmp/tmp9CCdaq.tmp", "****.txt.gz", Resume, Retry)
# GetFileSize("****.txt.gz", -1)
Command: SIZE ****.txt.gz
Status: Waiting for response to: SIZE ****.txt.gz
Response: 213 85049263
# OpenRead("****.txt.gz", Binary, 0, 85049263)
Command: TYPE I
Status: Waiting for response to: TYPE I
Response: 200 Command TYPE okay.
# OpenPassiveDataStreamAsync(PASV, "RETR ****.txt.gz", 0)
Command: PASV
Status: Waiting for response to: PASV
Response: 227 Entering Passive Mode (*,*,*,*,181,29)
Status: Connecting to *.*.*.*:46365
Command: RETR ****.txt.gz
Status: Waiting for response to: RETR ****.txt.gz
Response: 150 Getting data connection.
Status: Disposing FtpSocketStream...
# OpenRead("****.txt.gz", Binary, 74993893, 0)
# GetFileSize("****.txt.gz", -1)
Status: Socket has stale data - prior to command execution
Status: The stale data was:
Stale: 226 Transfer complete.
Status: Closing stream because of stale data
Status: Disposing FtpSocketStream...
# ConnectAsync()
Status: FluentFTP 42.0.0.0
Status: Connecting to *.*.*.*:21
Status: Waiting for a response
Response: 220 Service ready for new user.
Command: USER ****
Status: Waiting for response to: USER ****
Response: 331 User name okay, need password for ****.
Command: PASS ***
Status: Waiting for response to: PASS ***
Response: 230 User logged in, proceed.
Command: FEAT
Status: Waiting for response to: FEAT
Response: 211-Extensions supported
Response: SIZE
Response: MDTM
Response: REST STREAM
Response: LANG en;zh-tw;ja;is
Response: MLST Size;Modify;Type;Perm
Response: AUTH SSL
Response: AUTH TLS
Response: MODE Z
Response: UTF8
Response: TVFS
Response: MD5
Response: MMD5
Response: MFMT
Response: 211 End
Status: Text encoding: System.Text.UTF8Encoding+UTF8EncodingSealed
Command: OPTS UTF8 ON
Status: Waiting for response to: OPTS UTF8 ON
Response: 200 Command OPTS okay.
Command: SYST
Status: Waiting for response to: SYST
Response: 215 UNIX Type: Apache FtpServer
Status: Listing parser set to: Machine
Command: SIZE ****.txt.gz
Status: Waiting for response to: SIZE ****.txt.gz
Response: 213 85049263
Command: TYPE I
Status: Waiting for response to: TYPE I
Response: 200 Command TYPE okay.
# OpenPassiveDataStreamAsync(PASV, "RETR ****.txt.gz", 74993893)
Command: PASV
Status: Waiting for response to: PASV
Response: 227 Entering Passive Mode (*,*,*,*,181,11)
Status: Connecting to *.*.*.*:46347
Command: REST 74993893
Status: Waiting for response to: REST 74993893
Response: 350 Restarting at 74993893. Send STORE or RETRIEVE to initiate transfer.
Command: RETR ****.txt.gz
Status: Waiting for response to: RETR ****.txt.gz
Response: 150 Getting data connection.
Status: Disposing FtpSocketStream...
# OpenRead("****.txt.gz", Binary, 149987786, 0)
# GetFileSize("****.txt.gz", -1)
Command: SIZE ****.txt.gz
Status: Waiting for response to: SIZE ****.txt.gz
Response: 226 Transfer complete.
# OpenPassiveDataStreamAsync(PASV, "RETR ****.txt.gz", 149987786)
Command: PASV
Status: Waiting for response to: PASV
Response: 213 85049263
Status: Disposing FtpSocketStream...
# Dispose()
Status: Disposing FtpClient object...
Status: Disposing FtpSocketStream...
Unhandled exception. FluentFTP.FtpException: Error while downloading the file from the server. See InnerException for more info.
---> FluentFTP.FtpException: Malformed PASV response: 85049263
at FluentFTP.Client.BaseClient.BaseFtpClient.GetPassivePort(FtpDataConnectionType type, FtpReply reply, String& host, Int32& port)
at FluentFTP.AsyncFtpClient.OpenPassiveDataStreamAsync(FtpDataConnectionType type, String command, Int64 restart, CancellationToken token)
at FluentFTP.AsyncFtpClient.OpenDataStreamAsync(String command, Int64 restart, CancellationToken token)
at FluentFTP.AsyncFtpClient.OpenRead(String path, FtpDataType type, Int64 restart, Int64 fileLen, CancellationToken token)
at FluentFTP.AsyncFtpClient.ResumeDownloadAsync(String remotePath, Stream downStream, Int64 offset, IOException ex, CancellationToken token)
at FluentFTP.AsyncFtpClient.DownloadFileInternalAsync(String localPath, String remotePath, Stream outStream, Int64 restartPosition, IProgress`1 progress, CancellationToken token, FtpProgress metaProgress, Int64 knownFileSize, Boolean isAppend)
--- End of inner exception stack trace ---
at FluentFTP.AsyncFtpClient.DownloadFileInternalAsync(String localPath, String remotePath, Stream outStream, Int64 restartPosition, IProgress`1 progress, CancellationToken token, FtpProgress metaProgress, Int64 knownFileSize, Boolean isAppend)
at FluentFTP.AsyncFtpClient.DownloadFileToFileAsync(String localPath, String remotePath, FtpLocalExists existsMode, FtpVerify verifyOptions, IProgress`1 progress, CancellationToken token, FtpProgress metaProgress)
at FluentFTP.AsyncFtpClient.DownloadFile(String localPath, String remotePath, FtpLocalExists existsMode, FtpVerify verifyOptions, IProgress`1 progress, CancellationToken token)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 68
Released as V42.1.0
Oooof. I will make a PR as an official fix for this strange problem and it will be in the next release.