curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Overcoming curl Error 28

From: Michael Newman via curl-users <curl-users_at_cool.haxx.se>
Date: Sat, 28 Mar 2020 11:52:08 +0700

This is very much a beginner question.

curl 7.64.0 (arm-unknown-linux-gnueabihf) libcurl/7.64.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3

I am using the following curl command in a bash script on a Raspberry Pi:

curl -v -n \
 --connect-timeout 5 \
 --max-time 120 \
 --retry 5 \
 --retry-delay 0 \
 --retry-max-time 40 \
 -T "$file" -P - $host >> $log 2>&1

It runs once every four minutes and uploads small webcam JPEGs to a web host. Most of the time it works just fine. But, about once an hour or so the transfer dies with error 28. Based on the verbose output, it looks like one chunk gets transferred immediately and then that's it.

It also appears that error 28 is not a "transient error" (I still don't know what that means), so the upload is not retried.

Is there some way to get curl to retry under these conditions or do I just have to put something in my shell script?

Mike Newman
Korat, Thailand

Verbose output:

* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x16bc880)
* Connected to ftp.xxxxxxx.com (nnn.nnn.nnn.nnn) port 21 (#0)
< 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
< 220-You are user number 3 of 25 allowed.
< 220-Local time is now 12:09. 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.
> USER xxxxxxx
< 331 User xxxxxxx OK. Password required
> PASS xxxxxxxxxxxxxxxxx
< 230 OK. Current restricted directory is /
> PWD
< 257 "/" is your current location
* Entry path is '/'
> CWD public_html
* ftp_perform ends with SECONDARY: 0
< 250 OK. Current directory is /public_html
> EPRT |1|192.168.0.165|46867|
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:— 0
< 200 PORT command successful
* Connect data stream actively
> TYPE I
< 200 TYPE is now 8-bit binary
> STOR chaamtest.jpg
< 150 Connecting to port 55789
* Preparing for accepting server on data port
* Checking for server connect
* Ready to accept data connection from server
* Connection accepted from server
} [43028 bytes data]

93917 0 0 45 43028 0 28363 0:00:03 0:00:01 0:00:02 28363 45
93917 0 0 45 43028 0 17074 0:00:05 0:00:02 0:00:03 17074 45
93917 0 0 45 43028 0 12216 0:00:07 0:00:03 0:00:04 12213 45
<snip>
93917 0 0 45 43028 0 360 0:04:20 0:01:59 0:02:21 0*
Operation timed out after 120000 milliseconds with 43028 bytes received 45
93917 0 0 45 43028 0 358 0:04:22 0:02:00 0:02:22 0
* Closing connection 0
curl: (28) Operation timed out after 120000 milliseconds with 43028 bytes received

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-03-28