-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Incorrect retry actions after transfer connection drops because server reports too long file size #1045
Comments
I can tell you what is happening:
This is the first transfer attempt. It fails, then detects stale data which causes a re-connect, the subsequent retry again fails, then reads stale data which came too late to be identified as being stale "226 Transfer complete" and from that point onwards a number of subsequent things go wrong. But why does the first download simply stop/die? Here are some ideas:
Could you post the source code - what is the client config? Once we find out more, lets change the title of this issue, as it is misleading. |
Sorry, no access to server logs, I changed download call without resume, and tried with sync call with here is the code snippet:
and the logs:
|
Ok, I will try your code. |
another strange thing is the SIZE command returned 85049263, but we got more from the server, first disconnecting after 79MB, second one after 140 MB. under Windows, it is different after
|
In my opinion there is a bug in the logic that continues the download after a failure. So two problems exist:
Let's concentrate on number 1 for a moment: You cannot get the server log. Ok. You want to transfer about 85MB. How long a time passes until the first fail? It is this part that interests me:
What time passes from Can you Wireshark trace the transfer? #2: The retry mechanism - which is using a reconnect and then a wrong size/offset. We will be investigating that. |
the duration depends on the network, it was taking about 1 minute to have 70 MB transferred and then transfer complete, I tried with other files in the same ftp server, only success with a file of 3.5 MB, but downloaded almost double size (6.4 MB). |
It will take some time to try to simulate this. Please stand by. |
Ok, using your code snippet - I am transfering a big file. If the transfer runs well, it finishes ok:
If I artificially "fail" the transfer in the middle, the resume logic takes over and tries to continue the download. I have not tested that yet to see if it would work. Looking at your logs, I am surprised that the resume logic immediately encounters "stale data", a
For the moment, please disregard anything that comes after that first failure, those are just consequential errors. The server drops the data connection some time in the middle, but also sends Are you able to test something if I create a special branch with some debugging code for you? |
Sure I can do some tests with you. Today I create a another code with old simple FtpWebRequest, strangely it is working, I checked the downloaded file size which is not the one returned by ftp server (76039496 instead of 85049263), here is the code, hope to help you
logs extracted from Wireshark:
|
Is that Wireshark extract from the FtpWebRequest or from FluentFtp? |
from FtpWebRequest, means that I got smaller size file than the server. |
I would be happy for the FluentFTP Wireshark trace :-) |
hello, should I give you some additional information or not ? @FanDjango |
Hi, thank you. Yes. Can you take a wireshark trace of the Fluentftp failure? |
|
I need to see all TCP Packets in this sequence, no editing:
|
I am sorry, I cannot help you. That is not what I expect when I would like to see a wireshark trace. Maybe you can find some way to debug exactly what is happening and why the connection is dropping. Perhaps investigate NOOP and also perhaps look at polling? |
I don’t understand, I just do a filtering to the ftp IP address in wireshark trace, do you have a example of what is supposed to be like ? |
During debug, I got an error: it seems that we can not trust the returned size, since we got the EOF before the fileLen reached, and the resume job will download from the beginning, again and again.
|
Also maybe the FTP server has a bug when he is serving a Somehow we are getting closer to the reason for the problem, you need to try some things. |
I set to mode S, but nothing changed
there are only .gz files on the server |
Can you execute a |
Did I understand correctly: you cannot access the server, like to do a |
STAT returned the server type and ip address like
I can only access by ftp protocol |
If the server returned |
That would be one possible solution. Also I am thinking about "readToEnd" as an option. I will work on it, how long are you still available at this time? |
more than 4hours |
Ok, ready for the next test, please use the same link. |
I did not see your commits in the branch, last commit was 1h ago ? |
oops. ok, pushed. |
|
Ok, small problem, I must solve. |
Next try, please. |
working now, get correct file size, big thanks @FanDjango !
|
Oooof. I will make a PR as an official fix for this strange problem and it will be in the next release. |
Currently I am inverstigating whether this fix should be generic (for all servers) or only for the Apache FTP server. I have implemented an Apache FTP server and I cannot reproduce this problem. I must assume that the server in this issue might be very old code? |
Sorry, no information about the server. |
It also said SIZE 12345 and that was not reliable, so don't make any assumptions about what else it might be saying. |
Released as V42.1.0 |
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 :
The text was updated successfully, but these errors were encountered: