Wednesday, November 17, 2021

[SOLVED] Git clone error: RPC failed - curl 28 Operation too slow

Issue

I am trying to clone the linux kernel, the transfer speed seems perfectly fine, but curl always aborts:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
error: RPC failed; curl 28 Operation too slow. Less than 1000 bytes/sec transferred the last 3 seconds
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

I have tried adding or removing --depth as well as using a different machine (one using Arch, the other on Ubuntu), same result...

Diagnostics

Setup

Arch Linux

❯ git --version
git version 2.33.1
❯ curl --version
curl 7.79.1 (x86_64-pc-linux-gnu) libcurl/7.79.1 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s 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 NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
❯ ldd "$(which curl)"
    linux-vdso.so.1 (0x00007ffcde7df000)
    /usr/lib/libstderred.so (0x00007fbb71615000)
    libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fbb71541000)
    libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fbb71520000)
    libc.so.6 => /usr/lib/libc.so.6 (0x00007fbb71354000)
    libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fbb7134d000)
    libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x00007fbb71321000)
    libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007fbb712fd000)
    libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007fbb712bc000)
    libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007fbb712a9000)
    libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fbb71217000)
    libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fbb70f38000)
    libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007fbb70ee3000)
    libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007fbb70dd2000)
    libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007fbb70dc4000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00007fbb70daa000)
    /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fbb71653000)
    libunistring.so.2 => /usr/lib/libunistring.so.2 (0x00007fbb70c28000)
    libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007fbb70b41000)
    libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007fbb70b0e000)
    libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007fbb70b08000)
    libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007fbb70af8000)
    libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007fbb70af1000)
    libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fbb70ad7000)
    libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007fbb70ab4000)

Speedtest:

curl -o /dev/null http://speedtest.tele2.net/100MB.zip  0,16s user 0,57s system 5% cpu 14,183 total

Retry

On a new day, it now gets a little further:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
remote: Compressing objects:  36% (26365/73234)

but still aborts whenever the transfer slows down for a few seconds:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
remote: Compressing objects:  36% (26365/73234)

The solution seems to be to pass --speed-time to curl via git, which I have no idea how to do even after looking at all git man pages related to configuration I could find.


Solution

After lots of frustration it became apparent that the problem was once again in front of the computer. The following option in my git config was the culprit:

[http]
    lowSpeedLimit = 1000
    lowSpeedTime = 3

Raising the values fixed it.



Answered By - xeruf