cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl crash after https connection failure

From: Mario Reif <mario.reif_at_factoryminer.com>
Date: Mon, 26 Jan 2015 10:15:43 +0100

Hello,

I am using libcurl on Raspberry-Pi with a C++ Programm to connect to a
webservice over https.

In my testcase the libcurl establishes a valid https connection to my
webserver,. Then I simply stopped my Apache daemon (not graceful) to
simulate a network failure. The drop of the connection was recognized
well by libcurl, curl_easy_perform returned a valid error code and my
program continued to work as expected. After I restarted my Apache
daemon my program tried to reconnect, but doing this it crashed. Crashed
means that the program stopped without any error message. I mean the
process was not hanging, it has simply terminated and was not running
any more.

I also tried to use CURLOPT_FRESH_CONNECT after an error was recognized
by libcurl, but it didn't help.

My question: Would a newer version of libcurl solve this problem? Can I
do anything within my program to catch the failure and prevent my
program to crash?

I am using the following versions:

Package: libcurl4-openssl-dev

Version: 7.26.0-1+wheezy12

Package: openssl

Version: 1.0.1e-2+rvt+deb7u14

Linux raspi20501 3.12.35+ #730 PREEMPT Fri Dec 19 18:31:24 GMT 2014
armv6l GNU/Linux

This is the verbose output from libcurl:

* Connection #0 seems to be dead!

* Closing connection #0

* About to connect() to fmdevsignaldetection port 443 (#0)

* Trying 192.168.1.104...

* connected

* Connected to fmdevsignaldetection (192.168.1.104) port 443 (#0)

* successfully set certificate verify locations:

* CAfile: none

CApath: /etc/ssl/certs

* SSL re-using session ID

* SSL connection using DHE-RSA-AES256-SHA

* Server certificate:

* subject: C=at; ST=Steiermark; L=Graz; O=FactoryMiner e.U.;
CN=fmdevsignaldetection

* start date: 2013-09-08 05:07:17 GMT

* expire date: 2023-09-06 05:07:17 GMT

* common name: fmdevsignaldetection (matched)

* issuer: C=at; ST=Steiermark; L=Graz; O=FactoryMiner e.U.;
CN=fmdevsignaldetection

* SSL certificate verify result: self signed certificate (18),
continuing anyway.

> POST /framework/scripts/app_portal.php HTTP/1.1

User-Agent: signaldetection.service

Host: fmdevsignaldetection

Accept: */*

Cookie: PHPSESSID=[deleted]

Content-Length: 3241

Expect: 100-continue

Content-Type: multipart/form-data;
boundary=----------------------------d08b8f8f2e20

* Empty reply from server

* Connection #0 to host fmdevsignaldetection left intact

* Server returned nothing (no headers, no data)

→ *The connection is lost, but the program is still running fine.
Libcurl returned a valid errorcode.*

* Connection #0 seems to be dead!

* Closing connection #0

→ *Here the program stops working. It crashed without any error messages...*

Best regards
Mario Reif

-- 
Dipl.-Ing. Mario Reif, B.Sc.
T: +43 (0)699 1129 1606
M: mario.reif_at_factoryminer.com
W: www.factoryminer.com
FACTORYMINER KG
Neubaugasse 34/5, 8020 Graz
Rechtsform: Kommanditgesellschaft
Firmenbuchnummer: 414866 y
Firmenbuchgericht: Landesgericht für ZRS Graz

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-26