FTP upload waiting for CWD command?

The FTP connection WD uses on my server connects a directoy level above where I want the files, so WD does a CWD command to get into the right directory before uploading files. However, from time to time I get WD files uploaded into the top level directory. This has always puzzled me, but I think I’ve come up with a possible reason.

I assume WD’s FTP code waits for a response of ‘250 CWD Command successful’ after sending the CWD command? However if my server is busy, the code might time-out waiting for the CWD command to complete. At this point, if the time-out expires I’m wondering if WD still uploads the files, leaving me with files in the top level directory? If this is happening, I think it should be changed so that a time-out at this point kills the upload session.

This problem certainly pops up here from time to time. I don’t use ftpupd :oops: and never had trouble, but I have noticed it happens sometimes with clientrawrealtimeftp since I’ve had that running. Let’s be careful asking for timeouts though, my host takes about 6 seconds to process a login so I wouldn’t want to trade one issue for another.

The ftp uploader already appears to have time-outs (there are settings on the config screen). I’m just wondering if the default action after a time-out waiting for the CWD command to complete is to carry on with the upload anyway. I’d rather have the transfer fail than have dozens of unwanted files uploaded to a directory that I have to clear out every so often.

if it fails, the cwd
then i do have a check in place if that if the filename is index.html or index.wml
then wd aborts that part

but i could make it abort regardless

I’d think it’s better to abort completely. If it ends up copying the files to the wrong place where they won’t be seen it’s probably not worth consuming the bandwidth to upload them in the first place. By the time I find the incorrectly uploaded files, they are usually days or weeks old anyway!

How about one more CWD try first?

one proble
some people have the cwd wrong
so a failure is OK for them
aborting means no upload for them, and more work for me trying to figure out why they said you broke it, fix it

Yes, that’s a very good point. It’s not always easy to get that right :oops:

one proble some people have the cwd wrong so a failure is OK for them aborting means no upload for them, and more work for me trying to figure out why they said you broke it, fix it

So perhaps time for an “I know I’ve got the CWD data correct, so please do a real time-out when the CWD times out” option? Something needs to be done, coz the directory above my real folder gets in a real mess!

one proble some people have the cwd wrong so a failure is OK for them aborting means no upload for them, and more work for me trying to figure out why they said you broke it, fix it
yes but the ftp log would still show them connecting to the server, just not uploading... so it could only either be nothing scheduled to be upload or cwd error if there is a problem..

it would be better if the server you ftp to did not stall the cwd command in the first place

Who said it was always the server? It could be any/all of:

  • Local LAN
  • Local router
  • Local network of your ISP
  • ISP network
  • ISP’s Internet connection
  • Server ISPs Internet connection
  • Server LAN
  • Server

It would be good to have all of these working 100% all of the time, but this is the Internet with no SLAs available to most people.

Timeouts happen, that’s why software has them. However, software should try it’s best to fail in the most appropriate way. At the moment WD is failing in a way which helps people who have incorrectly set their system up and messes up for people who have correctly set their system up.

uploading a new 10.17w now, with ftpupd.exe 7.42
where you can tick the setting to not carry on if failed CWD command, in the connections setup in the ftp/internet setup (bottom right hand corner of the pink setup area)

There’s still something odd going on. I’ve got the ‘Don’t carry on if CWD fails’ item ticked, but there are currently a lot of files timestamped at 21:17 today sat in the directory above the correct directory.

The weird thing is that the files from the 21:02 upload are all in the correct directory.

I didn’t touch the WD machine between around 22:00 last night and 21:25 this evening, so the files were definitely uploaded to the correct and incorrect folders in two seperate runs. The 21:02 upload run ended with a 10054 error and the 21:17 run says that there was a FTP timeout due to a 10060 error, but there were still files uploaded, so it must have failed part way through…or perhaps the CWD failed in a way that FTPUPD wasn’t expecting?

Unfortunately I was too slow to catch the ftplogfull before the next update run.

ok, i will do some tests (i.,e with a CWD that will fail each time)

ok, found out what i was doing wrong
try 10.17y, which has a new ftpupd.exe version :slight_smile:

I’ll try it when my latest MySQL monthly upload has finished. I’ve got over 300,000 records uploaded so far, mainly from 2003.

if i get time today, i will option to have year coloumn in the database…
(which a user would have to add)

Are you intending to check if the column exists and if it does send the extra year data to the server, or do you want to try the record version numbering idea?

10.17y doesn’t fix this, but I just caught a ftplogfull before it got overwritten and I think I’ve worked out what the problem is.

For some reason my FTP uploads are timing out. I need to investigate why that should be, but…

When the FTP upload starts, it logs in, then uses the CWD command to get itself into the right directory. That’s OK. However, if an upload session then times out, the FTP program logs back in to continue the upload. Unfortunately the second, and subsequent, logins don’t re-send the CWD command, so all files after a time-out are uploaded into the wrong directory.