question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect retry actions after transfer connection drops because server reports too long file size

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:68

github_iconTop GitHub Comments

1reaction
FanDjangocommented, Dec 1, 2022

Released as V42.1.0

1reaction
FanDjangocommented, Nov 24, 2022

Oooof. I will make a PR as an official fix for this strange problem and it will be in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot sync health and errors in Azure File Sync
The file has been identified to produce persistent errors during sync. Hence it is blocked from sync until the retry interval is reached....
Read more >
Troubleshoot file system transfers
Error message Error type What the error means Failed due to invalid file name INVALID_FILE_NAME The path of a source file is invalid. Failed due...
Read more >
Troubleshoot Content Distribution issues
Describes how to troubleshoot common content distribution problems.
Read more >
What is “HTTP 500 Internal Server Error” and How to Fix It?
The “HTTP 500 Internal Server Error” is very common and it can be caused by various problems. Learn more about the error and...
Read more >
SQL Server troubleshooting: Disk I/O problems
In this article, we will discuss how to resolve I/O problems that is a very important point for the SQL Server troubleshooting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found