Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2020 07:35:50 +1000
From:      Andrew Reilly <areilly@bigpond.net.au>
To:        freebsd-stable@freebsd.org
Subject:   Curl giving (27) Out of memory error where it didn't before
Message-ID:  <93AF62DD-3638-4326-BDAC-0054793FAB07@bigpond.net.au>

next in thread | raw e-mail | index | archive | help
Hi there,

I have a cron job that is supposed to email me at a backup email account =
if my ISP ever changes my IP address.  It doesn't happen very often, but =
it happened again this morning, and I was disappointed to find that the =
script that does the notification failed.

Sending e-mail in this way requires SSL connection to my ISP's mail =
server (smtp.bigpond.com) and authentication, and I was pleased to =
discover, a while back, that curl can handle both of those details, as =
well as sending email.  So I use this script (edited to elide passwords =
and addresses):
email-myself.sh:
#!/bin/sh
/usr/local/bin/curl -v -T- --ssl-reqd smtps://smtp.bigpond.com =
--mail-from areilly@bigpond.net.au --mail-rcpt backup_address@me.com =
--mail-auth areilly@bigpond.net.au --user =
areilly@bigpond.net.au:password <<END
From: Andrew Reilly <areilly@bigpond.net.au>
To: Andrew Reilly <backup_address@me.com>
Subject: $1
Date: $(date -R)

$2
END

As I said, previously that has worked perfectly, but today I'm getting =
the following in my logs (thanks to having verbose output turned on):

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  =
Current
                                 Dload  Upload   Total   Spent    Left  =
Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:-- =
    0*   Trying 203.36.137.240:465...
* Connected to smtp.bigpond.com (203.36.137.240) port 465 (#0)
* successfully set certificate verify locations:
*   CAfile: /usr/local/share/certs/ca-root-nss.crt
  CApath: none
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [91 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4836 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
*  subject: C=3DAU; ST=3DVictoria; L=3DMelbourne; O=3DTelstra =
Corporation Limited; OU=3DTechnology Product Ownership CH10; =
CN=3Dmail.bigpond.com
*  start date: Jan 23 03:57:06 2020 GMT
*  expire date: Jan 23 04:07:00 2022 GMT
*  subjectAltName: host "smtp.bigpond.com" matched cert's =
"smtp.bigpond.com"
*  issuer: C=3DBM; O=3DQuoVadis Limited; CN=3DQuoVadis Global SSL ICA G2
*  SSL certificate verify ok.
{ [5 bytes data]
< 220 smtp.telstra.com ESMTP Service ready
} [5 bytes data]
> EHLO Zen
{ [5 bytes data]
< 250-smtp.telstra.com
< 250-8BITMIME
< 250-PIPELINING
< 250-HELP
< 250-AUTH=3DLOGIN
< 250-AUTH LOGIN PLAIN
< 250-DELIVERBY 300
< 250 SIZE 30000000
} [5 bytes data]
> AUTH PLAIN
{ [5 bytes data]
< 334 ?
} [5 bytes data]
> AGFyZWlsbHlAYmlncG9uZC5uZXQuYXUARnJhaGFuMHc=3D
{ [5 bytes data]
< 235 PLAIN authentication successful
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:-- =
    0
} [5 bytes data]
> QUIT
{ [5 bytes data]
< 221 smtp.telstra.com QUIT
* Closing connection 0
} [5 bytes data]
* TLSv1.2 (OUT), TLS alert, close notify (256):
} [2 bytes data]
curl: (27) Out of memory

That looks to me as though the SSL setup worked fine, then the AUTH =
fine, then the message transfer all fine, and quitting too.  So =
everything was fine, but then curl crashed with error 27 "out of =
memory", and I haven't received any messages.

The web thinks that the two most likely ways for an out-of-date shared =
library linkage or a not-thread-safe programming bug.  So I used =
portmaster -f to rebuild curl and all its dependencies, and it still =
crashes exactly as shown.

The computer in question is running: (uname -a)
FreeBSD Zen.local 12.1-STABLE FreeBSD 12.1-STABLE r359760 GENERIC  amd64

and has 32G of RAM and eight two-thread AMD 1700 cores.

Any suggestions?

Andrew Reilly
M: 0409-824-272
areilly@bigpond.net.au






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93AF62DD-3638-4326-BDAC-0054793FAB07>