1

I am seeing that some ftp clients cannot complete when transferring thousands of files to an FTP server. The mput * command runs for several hours and then hangs in

150 Opening BINARY mode data connection.

I do not have an easy way to contact the FTP server administrators (all I have is an IP address in the block managed by WeHostWebSites.Com and I know that this IP is shared by a dozen of domain names).

The FTP server introduces itself as

220 Microsoft FTP Service

So I assume it is IIS.

I am running an mput * on a directory that contains thousands of files. Until the transfer hangs for a while, until the control connection is closed for inactivity.

Having examined the logs I see the following pattern. Initially the files are transferred in passive mode.

229 Entering Extended Passive Mode (|||53567|)
150 Opening BINARY mode data connection.

Then the port numbers increase until they reach 65200. At this point the server returns 501.

229 Entering Extended Passive Mode (|||65201|)
501 Server cannot accept argument.

Which triggers the clients such as lukemftp (that comes by default with OpenSUSE 11 installations) or FAR manager FTP plugin (which is popular with Windows users) to switch to active so the following transfers start with the PORT command.

200 PORT command successful.
150 Opening BINARY mode data connection.

netstat -t also shows that new connections go to port 20/tcp of the server. After transferring another 3000+ files the command hangs. At this point the output from netstat -t shows how TIME_WAIT connections drain and then the control connection is closed for inactivity.

Workaround: It is often suggested to use lftp for large FTP transfers and this proved to be a way round the problem. Watching lftp executing a mirror -R command on a directory with 100000+ files I can see how the dynamic port numbers run up to 65200 and then continue from 49152 keeping all transfers in passive. So this command completes successfully.

Is there a way to work around this problem without the use of lftp (In particular, what could be done on a purely Windows client that does not have lftp?

Notice: This question was posted several months ago on http://serverfault.com but did not receive any answers and a recent close vote. I decided to remove it from ServerFault and repost it on SuperUser instead.

1

Is there a on access antivirus-software or continous backup software on the server? Maybe disabling it for testing purposes changes something.

Think of the following process:

  1. put file from ftp-client to server
  2. server opens stream to temporary file
  3. antivirus-software or backup-software locks the (temporary) file for scanning or backup
  4. while scanning the temporary file the ftp-server wants to move the finished file to its final location and name
  5. since the file is locked at this moment the final operation could fail and throw an error.
  • I guess this move failure would be somehow reflected in the server log. So the key thing is to get hold of the server logs, right? – Dmitri Chubarov Oct 14 '14 at 12:28
  • yes. consult the eventlog and the ftp-log. If you haven't already done, switch on extensive logging for the ftp-service. – Martin Seitl Oct 16 '14 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.