Skip to content

curl 7.87.0 ftp 1800 files, get 2 errors - ftp timeout, followed by (27) out of memory #10130

Closed

Description

@kitsguru

I did this

I am using git-ftp v1.6.0 to transfer files from my machine to my VPS.
I am trying to upload 1300 files and delete 500 files
I get the following:
Files start to upload
ftp timeout error
curl continues then fails again with timeout error
Continues a third time then fails with Error(27) Out of memory

I expected the following

all files to upload and delete according to git-ftp transfer log

curl/libcurl version

curl 7.87.0 (x86_64-apple-darwin21.6.0) libcurl/7.87.0 (SecureTransport) OpenSSL/1.1.1s zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.4 libssh2/1.10.0 nghttp2/1.51.0 librtmp/2.3
Release-Date: 2022-12-21

[curl -V output]
curl 7.87.0 (x86_64-apple-darwin21.6.0) libcurl/7.87.0 (SecureTransport) OpenSSL/1.1.1s zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.4 libssh2/1.10.0 nghttp2/1.51.0 librtmp/2.3
Release-Date: 2022-12-21
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Darwin xxx.local 21.6.0 Darwin Kernel Version 21.6.0: Sun Nov 6 23:31:16 PST 2022; root:xnu-8020.240.14~1/RELEASE_X86_64 x86_64

Activity

  1. dfandrich commented on Dec 21, 2022

    @dfandrich
    Contributor
  2. kitsguru commented on Dec 21, 2022

    @kitsguru
    Author

    Too be honest, I have not done anything to rule out git-ftp or the server other than post an issue with git-ftp.

    Everything was working fine yesterday, then this morning when I updated curl via homebrew, the issue started. That is the only recent change as no other updates have occurred.

    Git-ftp was lasted updated a year ago. I use cPanel [106.0.11] on my VPS which was updated on Dec 1, 2022

  3. kitsguru commented on Dec 21, 2022

    @kitsguru
    Author

    I just did a quick test by creating 140 files which successfully uploaded. I then reverted the commit and git-ftp successfully deleted the files just uploaded.

    As best I can determine git-ftp creates a file with the files to upload and passes that to curl.

  4. bagder commented on Dec 22, 2022

    @bagder
    Member

    Without a much more detailed description of what is happening at a protocol level and info about what libcurl is told to do for these transfers and specific info how/when it fails, it is difficult for us to do anything more than blindly guess.

  5. kitsguru commented on Dec 22, 2022

    @kitsguru
    Author

    So this morning I did a bit of digging into git-ftp:

    This is the command that is executed:

    curl -s --globoff -# --ftp-create-dirs -K /var/folders/p1/2q6_xz196qsg9g3j67d8qf7c0000gn/T/git-ftp-XXXXXX.C12jHSJ5/curl_upload_list
    

    sample record from the curl_upload_list - 1380 entries
    xxxxx is the domain
    yyyyyyy was the password

    -T "./www/templates/site/xxxxx/right-col.twig"
    url = "ftp://xxxxx:yyyyyyy@ftp.xxxxx.com/www/templates/site/xxxxx/right-col.twig"
    

    The first timeout occurs at record 528

    * Remembering we are in dir "www/cmsb/lib//menus/_codeGenerator/"
    < 226-File successfully transferred
    < 226 0.083 seconds (measured here), 52.88 Kbytes per second
    * Connection #0 to host ftp.xxxxx.com left intact
    
    * Found bundle for host: 0x600003faf540 [serially]
    * Re-using existing connection #0 with host ftp.xxxxx.com
    * Request has same path as previous transfer
    > EPSV
    * Connect data stream passively
    * ftp_perform ends with SECONDARY: 0
    < 229 Extended Passive mode OK (|||57903|)
    * Connecting to 111.111.111.111 (111.111.111.111) port 57903
    *   Trying 111.111.111.111:57903...
    * Connected to ftp.xxxxx.com (111.111.111.111) port 21 (#0)
    > STOR api_categoryMenu.php
    < 150 Accepted data connection
    } [15151 bytes data]
    * We are completely uploaded and fine
    ################################################################################################################# 100.0%
    * Remembering we are in dir "www/cmsb/lib//menus/_codeGenerator/"
    * FTP response timeout
    * control connection looks dead
    * Closing connection 0
    curl: (28) FTP response timeout
    
    *   Trying 111.111.111.111:21...
    * Connected to ftp.xxxxx.com (111.111.111.111) port 21 (#1)
    < 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
    < 220-You are user number 1 of 50 allowed.
    < 220-Local time is now 16:44. Server port: 21.
    < 220-This is a private system - No anonymous login
    < 220-IPv6 connections are also welcome on this server.
    < 220 You will be disconnected after 15 minutes of inactivity.
    
    < 230 OK. Current restricted directory is /
    > PWD
    < 257 "/" is your current location
    * Entry path is '/'
    > CWD www
    * ftp_perform ends with SECONDARY: 0
    < 250 OK. Current directory is /public_html
    > CWD cmsb
    < 250 OK. Current directory is /public_html/cmsb
    > CWD lib
    < 250 OK. Current directory is /public_html/cmsb/lib
    > CWD menus
    < 250 OK. Current directory is /public_html/cmsb/lib/menus
    > CWD _codeGenerator
    < 250 OK. Current directory is /public_html/cmsb/lib/menus/_codeGenerator
    > EPSV
    * Connect data stream passively
    < 229 Extended Passive mode OK (|||49664|)
    * Connecting to 111.111.111.111 (111.111.111.111) port 49664
    *   Trying 111.111.111.111:49664...
    * Connected to ftp.xxxxx.com (111.111.111.111) port 21 (#1)
    > TYPE I
    < 200 TYPE is now 8-bit binary
    > STOR api_comboPage.php
    < 150 Accepted data connection
    } [9745 bytes data]
    * We are completely uploaded and fine
    

    second timeout occurred at record 565
    died on record 636

    * Remembering we are in dir "www/cmsb/plugins//csvExport/"
    < 226-File successfully transferred
    < 226 0.084 seconds (measured here), 23.43 Kbytes per second
    * Connection #2 to host ftp.xxxxx.com left intact
    
    * Found bundle for host: 0x600003fa0060 [serially]
    * Re-using existing connection #2 with host ftp.xxxxx.com
    * Request has same path as previous transfer
    > EPSV
    * Connect data stream passively
    * ftp_perform ends with SECONDARY: 0
    < 229 Extended Passive mode OK (|||63906|)
    * Connecting to 111.111.111.111 (111.111.111.111) port 63906
    *   Trying 111.111.111.111:63906...
    * Connected to ftp.xxxxx.com (111.111.111.111) port 21 (#2)
    > STOR csvExport.php
    < 150 Accepted data connection
    } [9432 bytes data]
    * We are completely uploaded and fine
    ################################################################################################################# 100.0%
    * Remembering we are in dir "www/cmsb/plugins//csvExport/"
    < 226-File successfully transferred
    < 226 0.083 seconds (measured here), 111.52 Kbytes per second
    * Connection #2 to host ftp.xxxxx.com left intact
    
    curl: (27) Out of memory
    

    If you can provide some guidance on what else I can do to trouble shoot this issue, I am happy to do so.
    I very much appreciate your help.

  6. dfandrich commented on Dec 22, 2022

    @dfandrich
    Contributor
  7. kitsguru commented on Dec 22, 2022

    @kitsguru
    Author

    remove now TY, and password reset

  8. dfandrich commented on Dec 22, 2022

    @dfandrich
    Contributor
  9. kitsguru commented on Dec 22, 2022

    @kitsguru
    Author

    I agree the FTP timeout does not appear to be an issue as it does reconnect.

    I opened the activity monitor and when curl first starts, it is using 2.0MB of memory
    When the (27) out of memory error occurs it is at 2.3MB

  10. dfandrich commented on Dec 22, 2022

    @dfandrich
    Contributor
  11. kitsguru commented on Dec 22, 2022

    @kitsguru
    Author

    Currently:
    ulimit -u 2048
    ulimit -n 524288
    cgroups is not install on my machine.

    I don't know what you mean by 'instrument curl' or how to do that.

    I have been using iterm2 so tried using terminal and got exactly the same results.

  12. dfandrich commented on Dec 22, 2022

    @dfandrich
    Contributor
  13. kitsguru commented on Dec 22, 2022

    @kitsguru
    Author

    ulimit -u is the number of processes available and not memory. I am well below that in running processes.
    Memory available is unlimited (iterm is using 160MiB)

  14. dfandrich commented on Dec 22, 2022

    @dfandrich
    Contributor
  15. 18 remaining items

  16. rtharston commented on Feb 4, 2023

    @rtharston

    And on the macOS provided 7.85.0 I get:

    ❯ curl -T nothing -v 'ftp://example.com/with space'
    curl: Can't open 'nothing'!
    curl: try 'curl --help' or 'curl --manual' for more information
    curl: (26) Failed to open/read local data from file/application
    
  17. rtharston commented on Feb 4, 2023

    @rtharston

    Now that I fixed that one path issue I installed curl 7.87.0 and tried pushing a larger change (982 files) and I hit the same Out of memory error on one of the files and then curl exited.

    Going back to 7.85.0 I got the proper curl: (3) URL using bad/illegal format or missing URL error and then curl continued to the next file as expected, giving me that error for each of the files with the bad path.

  18. added a commit that references this issue on Feb 5, 2023
    5691a9b
  19. dfandrich commented on Feb 5, 2023

    @dfandrich
    Contributor

    Does #10414 fix it for you?

  20. rtharston commented on Feb 5, 2023

    @rtharston

    I'll build and try it out.

  21. rtharston commented on Feb 5, 2023

    @rtharston

    I am struggling with build settings. I can build curl, but when I try to use it with git-ftp I get errors.

    Looking at the code changes though I'm pretty confident you got it. Classic C issue where the errors don't get propagated properly.

  22. dfandrich commented on Feb 5, 2023

    @dfandrich
    Contributor

    Actually, all this will fix is to give the ability to git-ftp to display a proper error message. git-ftp will still need to be fixed to escape URLs properly so they are valid when given to curl.

  23. kitsguru commented on Feb 5, 2023

    @kitsguru
    Author

    I can confirm that spaces in the path are my issue as well with curl 7.87

  24. rtharston commented on Feb 5, 2023

    @rtharston

    Yes, this doesn't fix the issue with git-ftp, but at least it lets the user know what the actual issue is.

    And there is a PR open with the fix for git-ftp: git-ftp/git-ftp#638

    I applied that change to my local copy and it fixed my issues.

  25. kitsguru commented on Feb 5, 2023

    @kitsguru
    Author

    I can confirm that the fix git-ftp/git-ftp#638 fixes the issue for me as well.

  26. added a commit that references this issue on Feb 7, 2023
    349c539
  27. added a commit that references this issue on Jul 19, 2023
    1d58eb0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions