-
Notifications
You must be signed in to change notification settings - Fork 385
ws_ftp and packet order #260
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
Comments
Thanks for the report. I'll see if I can get ws_ftp-pro working with wine so I can attempt to reproduce the issue. |
This is going to be a bit of a challenge. Grabbed ws-ftp-pro trial version and it installed fine with wine but the activation doesn't work. Wasn't able to active using the online method or the offline method. Both failed telling me to contact customer support. |
I'm a bit stumped at how the 2 packets could get out of order. Packets must be responded to in the same order they are received in general and the packet-manager code was added to address this requirement. It keeps track of the incoming packets currently being handled by the workers and only responds when it can do it in order (buffering finished responses until earlier ones are ready). The only thing that I can think of at the moment is the packet request-ids might not be sort-able. Every client I've tried so far has incremental packet-ids but the spec doesn't require this nor does it even require that they are unique. @purha, if you could possible print out a few of the request-ids for these packets it would help at least eliminate that possibility. Thanks. |
Hi, I used one of the windows test images for virtualbox https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ This is log for downloading 5 files when one succeeded and others failed: Listening on [::]:2022 I hope this helps |
@purha Thanks! This does seem to confirm my suspicions as those packet ids are not incremental, they do seem to jump around. My first idea to address this is to use an internal, incremental id for each packet and use that to ensure ordering it maintained. At first glance it seems like it might be fairly straightforward, but I'll need to dig into it to be sure. |
Hi, we are facing a similar issue with the same client. we didn't have any issues downloading a trial version of the client. Alistair |
Thanks for reporting the issue @ali11011, I'm working on it and will report here when I have a branch ready for testing. |
My naive thought that I could just embed the current packets in an ordered packet is not working out. A lot of type checking/asserting makes it pretty ugly. So I'm thinking of reversing things and embedding an ordering field in each packet. More code, but simpler. |
Embedding the ordering into the existing packets is working out better. The request-server had things abstracted out enough that it was easy. The old filesystem server implementation not so much. But it is coming along. |
hi, how is the progress coming along for this fix? Alistair |
note we now have reports of 0kb files being generated on upload to the sFTP layer now as well as download |
Sorry about the troubles. I'm still actively working on it though my second attempt also didn't work out as I'd hoped. I have another avenue I'm trying and am still hopeful to have it fixed this week. Same problem would apply both uploading and downloading. Best short term solution would be to use another SFTP client (filezilla, winscp, cyberduck, openssh's client). |
appreciate the efforts!! i am afraid we cannot ask our customers to change their middle-ware solution because of a bug on our end. |
Alternative short term solution would be to re-compile with SftpServerWorkerCount set to 1. Won't be as fast, but should fix this issue while I'm working on a better fix. |
we did this already yesterday, but for some reason it seems like we are still getting 0kb on upload. still waiting for 100% confirmation that issue is re-occurring, but it looks like it is |
well actually seems that it resolved issue for downloads. still waiting for confirmation of success for uploads. the performance impact is noticeable however, so looking forward to long term fix |
upload was not fixed by dropping worker count to 1 |
I have a branch which uses an internal count for ordering, which should fix this. I have finished the code and just pushed the branch (packet-embedded-in-ordered) and created a pull request (#263). I'm going to try to test it today by installing ws-ftp in a VM, but I have limited time and may not get done with it. If either of you ( @ali11011 or @purha) get a chance to test the branch please let me know how it goes. Thanks and thank you for your patience. |
I'm having trouble reproducing this using the ws-ftp GUI from Win10 in a virtualbox to local linux system running the sftp-server example. Tried transferring up/down various files from 20 bytes to 4kb using the current master branch (wanted a baseline before trying the new branch). Hopefully you guys have better luck testing. I'll try again later, but am giving up for now. |
looks like it's not working properly with worker count = 8, here's the log, dirlist and single download: Listening on [::]:2022 however uploads seems to work fine even with 8 workers. Here's the log for one worker and succesful download: Listening on [::]:2022 |
That bit... 10 is sent before 9. That should be impossible, so something is amiss there. I really wish this was easier to reproduce. Anyone have any tips for reproducing this please pass them along. |
I see it... ws-ftp gave 2 packets in a row the same id and I'm still using the packet's id to determine if the packet is the right one to send. Seems insane to use the same id in a row like that, but it is legal. Reading the spec it is legal for them to use the same id for every packet. Guess I need to just ignore that and use the order-id for all this. One minute... I'll update the PR with the changed code. |
I've been able to reproduce it a couple times on the master branch and not on my new branch. I'm doing it manually in the GUI and so can't abuse it much, but seems hopeful. Please let me know if you're able to test it some more. Thanks. |
looks like now it's working properly, thanks @eikenb ! |
@ali11011 Can you also test it? I'd like additional confirmation of its behavior before merging if possible. Thanks. |
Hi yes. all looks good, we have a full day of production usage with no issues! |
ensure packet responses in same order as requests Fixes #260
Just pushed v1.8.1 with the fix for this included. |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
using ws ftp pro (trial latest version) library seems to have issues.
This can be replicated using the sftp-server example, having for example 20 files with small amount of data, I tested 22 bytes.
Using command "C:\Program Files (x86)\Ipswitch\WS_FTP 12\wsftppro.exe" -s sftp-lib-conf:/path_to/github.com/pkg/sftp/examples/sftp-server/testfile* -d local:C:\temp\
Some of the files come as empty. Also sometimes just changing the directory in UI fails.
I think this is related to packets coming/going in wrong order. Temporary fix that I found was to set SftpServerWorkerCount=1
I debugged the issue and failing transfers it seems to read with offset greater than filesize, when server responds EOF the next packet with offset zero and correct data seems to be ignored by the client.
In succesfull transfers offset zero packet seems to come first.
This issue is not in openssh server, it seems to always receive offset zero first.
Mikko.
The text was updated successfully, but these errors were encountered: