FTP-Deploy-Action icon indicating copy to clipboard operation
FTP-Deploy-Action copied to clipboard

Error: Client is closed / Closing reason: Error: read ECONNRESET (data socket)

Open davetapley opened this issue 3 years ago β€’ 13 comments

Bug Description

First time using the action, ~so not sure if this is a regression~ confirmed new in 4.0.0, works in 3.1.1 (see comment below) Followed README and action appears to work (due to #123) but log inspection shows otherwise.

Opening this issue specifically for the Error: Client is closed / Closing reason: Error: read ECONNRESET (data socket) error (see log below).

My Action Config

ftp-share:
    name: Upload assets to FTP server
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          lfs: true
          fetch-depth: 2

      - name: Update files on FTP server
       uses: SamKirkland/[email protected]
       with:
         server: ftp.<REDACTED IIS FTP SITE>.com
         username: <REDACTED>
         password: ${{ secrets.FTP_PASSWORD }}
         protocol: ftps
         security: strict
         log-level: verbose

My Action Log

----------------------------------------------------------------
πŸš€ Thanks for using ftp-deploy. Let's deploy some stuff!   
----------------------------------------------------------------
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
Creating local state at ./.ftp-deploy-sync-state.json
Local state created
Connected to 72.203.251.54:21 (No encryption)
< 220 Microsoft FTP Service

> AUTH TLS
< 234 AUTH command ok. Expecting TLS Negotiation.

Control socket is using: TLSv1.2
Login security: TLSv1.2
> USER <REDACTED>
< 331 Password required

> PASS ###
< 230 User logged in.

> TYPE I
< 200 Type set to I.

> STRU F
< 200 STRU F ok.

> OPTS UTF8 ON
< 200 OPTS UTF8 command successful - UTF8 encoding now ON.

> OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;
< 501 Option not supported.

> PBSZ 0
< 200 PBSZ command successful.

> PROT P
< 200 PROT command successful.

  changing dir to ./
> MKD .
< 550 Access is denied. 

> CWD .
< 250 CWD command successful.

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

Optimal transfer strategy found.
> RETR .ftp-deploy-sync-state.json
----------------------------------------------------------------
No file exists on the server "./.ftp-deploy-sync-state.json" - this much 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:	973
Server Files:	973
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
βž• Upload: favicon.ico


[SNIP]

----------------------------------------------------------------
Making changes to 973 files to sync server state
Uploading: 432 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "gmap_files/"
  changing dir to gmap_files
Error: Client is closed
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3704:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3684:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:2745:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3251:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3242:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1962:121
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1823:71
    at new Promise (<anonymous>)
Closing reason: Error: read ECONNRESET (data socket)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27) ***
  code: 'ECONNRESET'
***
Error: Client is closed
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3704:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3684:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:2745:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3251:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3242:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1962:121
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1823:71
    at new Promise (<anonymous>)
Closing reason: Error: read ECONNRESET (data socket)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27) ***
  code: 'ECONNRESET'
***
----------------------------------------------------------------
Time spent hashing:               1.7 seconds
Time spent connecting to server:  902 milliseconds
Time spent deploying:             3 milliseconds (156 GB/second)
  - changing dirs:                126 milliseconds
  - logging:                      28 milliseconds
----------------------------------------------------------------
Total time:                       3 seconds
----------------------------------------------------------------

IIS Log

2020-12-31 20:11:38 52.184.187.148 - <REDACTED> 21 ControlChannelOpened - - 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:38 52.184.187.148 - <REDACTED> 21 AUTH TLS 234 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:38 52.184.187.148 - <REDACTED> 21 USER <REDACTED> 331 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:38 52.184.187.148 <REDACTED> <REDACTED> 21 PASS *** 230 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 /
2020-12-31 20:11:38 52.184.187.148 <REDACTED> <REDACTED> 21 TYPE I 200 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:38 52.184.187.148 <REDACTED> <REDACTED> 21 STRU F 200 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:38 52.184.187.148 <REDACTED> <REDACTED> 21 OPTS UTF8+ON 200 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 OPTS MLST+type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname; 501 87 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 PBSZ 0 200 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 PROT P 200 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 MKD . 550 5 5 a1147643-fb62-4d6f-a4ce-97843f640354 /
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 CWD . 250 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 /
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 EPSV - 229 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 5822 DataChannelOpened - - 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 5822 DataChannelClosed - - 2 3 a1147643-fb62-4d6f-a4ce-97843f640354 -
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 RETR .ftp-deploy-sync-state.json 550 2 3 a1147643-fb62-4d6f-a4ce-97843f640354 /.ftp-deploy-sync-state.json
2020-12-31 20:11:39 52.184.187.148 <REDACTED> <REDACTED> 21 ControlChannelClosed - - 0 0 a1147643-fb62-4d6f-a4ce-97843f640354 -

davetapley avatar Dec 31 '20 20:12 davetapley

Work around

I was able to get it to work on 3.1.1 with ⬇️, ~although I then ran in to #114~ and https://github.com/SamKirkland/FTP-Deploy-Action/issues/114#issuecomment-753214479

    steps:
      - uses: actions/checkout@v2
        with:
          lfs: true
          fetch-depth: 0

      - name: Update files on FTP server
        uses: SamKirkland/[email protected]
        with:
          ftp-server: ftpes://ftp.<REDACTED>.com
          ftp-username: <REDACTED>
          ftp-password: ${{ secrets.FTP_PASSWORD }}

davetapley avatar Dec 31 '20 21:12 davetapley

Wanted to make a new issue, but since i have exactly the same problem, i will post here.

Will try https://github.com/SamKirkland/FTP-Deploy-Action/issues/153#issuecomment-753198797 and update my post

main.yml

name: "πŸš€ Upload to FTP"
on:
  push:
    branches:
    - main
jobs:
  web-deploy:
    name: πŸŽ‰ Deploy
    runs-on: ubuntu-latest
    steps:
    - name: 🚚 Get latest code
      uses: actions/[email protected]
      with:
          lfs: true
          fetch-depth: 2
    - name: πŸ“‚ Sync files
      uses: SamKirkland/[email protected]
      with:
        server: ${{ secrets.FTP_HOST }}
        username: ${{ secrets.FTP_USER }}
        password: ${{ secrets.FTP_PASSWORD }}
        exclude: "[**/.git*/**, **/node_modules/**, **/build/, .README.MD, .gitignore]"
        protocol: ftps
        log-level: verbose

action log:

Run SamKirkland/[email protected]
  with:
    server: ***
    username: ***
    password: ***
    exclude: [**/.git*/**, **/node_modules/**, **/build/, .README.MD, .gitignore]
    protocol: ftps
    log-level: verbose
----------------------------------------------------------------
πŸš€ Thanks for using ftp-deploy. Let's deploy some stuff!   
----------------------------------------------------------------
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*/**","**/node_modules/**","**/build/",".README.MD",".gitignore"]
Creating local state at ./.ftp-deploy-sync-state.json
Local state created
Connected to ***:21 (No encryption)
< 220 Multicraft 2.3.5 FTP server

> AUTH TLS
< 234 AUTH TLS successful.

Control socket is using: TLSv1.3
Login security: TLSv1.3
> USER ***
< 331 Username ok, send password.

> PASS ###
< 230 Login successful

> FEAT
< 211-Features supported:

<  AUTH SSL
 AUTH TLS
 EPRT
 EPSV
 MDTM
 MFMT
 MLST type*;perm*;size*;modify*;unique*;unix.mode;unix.uid;unix.gid;
 PBSZ
 PROT
 REST STREAM
 SIZE
 TVFS
 UTF8

< 211 End FEAT.

> TYPE I
< 200 Type set to: Binary.

> STRU F
< 200 File transfer structure set to: F.

> OPTS UTF8 ON
< 200 OK

> 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;

> PBSZ 0
< 200 PBSZ=0 successful.

> PROT P
< 200 Protection set to Private

  changing dir to ./
> MKD .
< 550 Unknown error 198.

> CWD .
< 250 "/" is the current directory.

  dir changed
Trying to find optimal transfer mode...
> EPSV
< 229 Entering extended passive mode (|||54117|).

Optimal transfer mode found.
> RETR .ftp-deploy-sync-state.json
----------------------------------------------------------------
No file exists on the server "./.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:	90
Server Files:	90
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
πŸ“ [...]
----------------------------------------------------------------
Making changes to 90 files/folders to sync server state
Uploading: 31 kB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "Banker/"
  changing dir to Banker

----------------------------------------------------------------
--------------  πŸ”₯πŸ”₯πŸ”₯ an error occurred  πŸ”₯πŸ”₯πŸ”₯  --------------
----------------------------------------------------------------

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

Error: Client is closed
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:3890:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:3870:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:2918:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:3436:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:3427:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:2256:121
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.1.0/dist/index.js:2241:71
    at new Promise (<anonymous>)
Closing reason: Error: read ECONNRESET (data socket)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27) {
  code: 'ECONNRESET'
}
Error: Error: Client is closed

superhize avatar Jul 03 '21 23:07 superhize

https://github.com/SamKirkland/FTP-Deploy-Action/issues/153#issuecomment-753198797 is working after hours. Only cause i thought ftpes:// was a mistake so i replaced it with ftps://

God damn i'm stupid.

superhize avatar Jul 04 '21 04:07 superhize

Same error here

rafakwolf avatar May 04 '22 20:05 rafakwolf

I'm struggling to create a FTP with explizit TLS connect.

If I understand the code correct, the protocol should be FTPS to pass down the secrue = true. So, my YML looks like:

    - name: Sync files
        uses: SamKirkland/[email protected]
        with:
          server: HOST
          protocol: ftps
          port: 21
          username: ${{ secrets.username }}
          password: ${{ secrets.password }}
          local-dir: ./build/
          server-dir: ./html/
          dry-run: false
          log-level: verbose

The pipeline action prints an error:

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:5[179](https://github.com/tsv-merschwitz/website/actions/runs/5485636413/jobs/9994685677#step:5:180):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:4744: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:3540:71
    at new Promise (<anonymous>)
Closing reason: Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
  code: 'ECONNRESET'
}
Error: Error: Client is closed because read ECONNRESET (data socket)

How can I establish a ftp connection to publish my files? Protokoll: FTP VerschlΓΌsselung: FTPS (explizites FTP ΓΌber TLS) Port: 21

I checked the connection with WinSCP. It's working.

ronny-springer avatar Jul 07 '23 11:07 ronny-springer

For me, I had to create the server directory in the server myself rather than allowing the tool to create the directory

emyb avatar Sep 12 '23 22:09 emyb

Lies, I think I just got lucky. Still not happening on large uploads.

emyb avatar Oct 17 '23 03:10 emyb

The workaround for adding an empty sync state json file seems to work. This is the second time this workaround has been helpful.

emyb avatar Oct 20 '23 01:10 emyb

The workaround for adding an empty sync state json file seems to work. This is the second time this workaround has been helpful.

Worked for me as well πŸ˜„

tbmsu avatar Dec 14 '23 20:12 tbmsu

The workaround for adding an empty sync state json file seems to work. This is the second time this workaround has been helpful.

Worked for me as well πŸ˜„

I have also ran into this problem for the initial deployment and adding the empty .ftp-deploy-sync-state.json file workaround did the trick!

neilzuk avatar Dec 21 '23 10:12 neilzuk