ftp-deploy icon indicating copy to clipboard operation
ftp-deploy copied to clipboard

ECONNRESET: Connection is closed on empty server-dir

Open JanST123 opened this issue 2 years ago • 1 comments

Hi, I am basically using the github action.

I noticed that, wenn the remote directory is empty, the FTP connection is closed by QUIT.

Reproduction:

  • Have an empty directory on the FTP server
  • Sync your files to that server
    • it tries to download the file list (which is empty)
    • then closed the FTP connection
    • then collect local files
    • tries to make the first directory on the ftp
    • crashes as the connection was closed on the remote side, because of the QUIT.
If you found this project helpful, please support it
by giving it a ⭐ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action
or add a badge 🏷️ to your projects readme --> https://github.com/SamKirkland/FTP-Deploy-Action#badge
Using the following excludes filters: ["**/.git*","**/.git*/**","**/node_modules/**"]
Creating local state at ./htdocs/.ftp-deploy-sync-state.json
Local state created
Connected to 202.x.x.x:21 (No encryption)
< 220 ProFTPD Server (ProFTPD) [202.x.x.x]

> AUTH TLS
< 234 AUTH TLS successful

Control socket is using: TLSv1.3
Login security: TLSv1.3
> USER xxx
< 331 Password required for xxx

> PASS ###
< 230 User xxx logged in

> FEAT
< 211-Features:

...

> TYPE I
< 200 Type set to I

> STRU F
< 200 Structure set to F

> OPTS UTF8 ON
< 200 UTF8 set to on

> OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;
< 200 MLST OPTS type;size;modify;unique;UNIX.mode;UNIX.owner;UNIX.group;UNIX.ownername;UNIX.groupname;

> PBSZ 0
< 200 PBSZ 0 successful

> PROT P
< 200 Protection set to Private

  changing dir to ./httpdocs/
> MKD .
< 550 .: File exists

> CWD .
< 250 CWD command successful

> MKD httpdocs
< 550 httpdocs: File exists

> CWD httpdocs
< 250 CWD command successful

  dir changed
Trying to find optimal transfer strategy...
> EPSV
< 229 Entering Extended Passive Mode (|||64293|)

Optimal transfer strategy found.
> RETR .ftp-deploy-sync-state.json
> QUIT
----------------------------------------------------------------
No file exists on the server "./httpdocs/.ftp-deploy-sync-state.json" - this must be your first publish! 🎉
The first publish will take a while... but once the initial sync is done only differences are published!
If you get this message and its NOT your first publish, something is wrong.
----------------------------------------------------------------
Local Files:	1,175
Server Files:	0
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
📁 Create: admin
....
----------------------------------------------------------------
Making changes to 1175 files/folders to sync server state
Uploading: 20.9 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "admin/"
  changing dir to admin

----------------------------------------------------------------
--------------  🔥🔥🔥 an error occurred  🔥🔥🔥  --------------
----------------------------------------------------------------

----------------------------------------------------------------
----------------------  full error below  ----------------------
----------------------------------------------------------------

Error: Client is closed because read ECONNRESET (data socket)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:5197:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:5179:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:4226:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:[47](https://github.com/xx#step:3:48)44:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:4735:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:3555:126
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.4/dist/index.js:3[54](https://github.com/xx)0:[71](https://github.com/xxx)
    at new Promise (<anonymous>)
Closing reason: Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:[217](https://github.com/xxx):20) {
  code: 'ECONNRESET'
}

The workaround would be to just put any file to the remote dir

JanST123 avatar Nov 29 '23 16:11 JanST123

Thank you, I am having the same issue. Setting dangerous-clean-slate: true fortunately fixes this problem for me.

hansmorb avatar Jan 29 '25 11:01 hansmorb