SamKirkland / ftp-deploy

Deploy websites over FTP with one command line
MIT License
89 stars 43 forks source link

FTPError: 421 No transfer timeout #21

Open ruucm opened 2 years ago

ruucm commented 2 years ago

It occurs with "Server sent FIN packet error." (of basic-ftp)

I found it occurs when this package creates folders for a long time.

Usually, when combined with GitHub actions, it takes over 10 minutes to create 200 ~ 300+ folders.

ruucm commented 2 years ago

Here is a rapid solution to resolve this, but we need a better solution.

Changing syncProvider.ts like below.

...

 // create new folders
  for (const file of diffs.upload.filter(item => item.type === "folder")) {
      await this.createFolder(file.name);
      await this.uploadFile('dummy.txt', "upload"); // to prevent "421 No transfer timeout"
  }

...
SamKirkland commented 2 years ago

This is a common error, it's due to routers/firewalls killing the connection. It happens on large file uploads as well but is dependent on the network from github->ftp server so it's extremely hard to recreate.

We can send a NOOP command via basic-ftp. I'd like to have a generalized solution because as I said this is a problem on more than just folder creation.

Have you been able to recreate this only when creating a large number of files?

NOOP FTP command

The NOOP command does not cause the server to perform any action beyond acknowledging the receipt of the command. This command can be issued to the server to prevent the client from being automatically disconnected for being idle. It can also prevent modern routers/firewalls from closing a connection that it perceives as being idle as well.

Common responses:

421 500

ruucm commented 2 years ago

Yes, I faced this issue an only a large number of files with a lot of subdirectories. (like deploying built files.)