cURL / Mailing Lists / curl-library / Single Mail

curl-library

SSL_shutdown crashes

From: Ganesh Ragavan <ganeshragavan_at_gmail.com>
Date: Wed, 23 Sep 2009 10:54:52 -0700

Just wondering if I could try some other fix ? I tried a newer
openSSL version and I see the same issue. Also please note that only
after the sleep, SSL_shutdown crashes. It runs fine till then.

> Hello,
>
> I am trying to run the following piece of code (I created this code to narrow down my problem). The code does the job for 1000 iterations in
> the while loop. In the while loop, after the sleep (1001 th iteration), the code crashes at the line curl_easy_perform(curl_desc). I added some debug statements into the
> libcurl code and I see the code crashing at the following place.
>
> file: curl-7.19.6\lib\ssluse.c
> function: void Curl_ossl_close(struct connectdata *conn, int sockindex)
> line: (void)SSL_shutdown(connssl->handle);
>
> Linux: 2.6.18
> openSSL version: 0.9.8, static
>
>
> I also checked the SSL_shutdown() input value, its a pointer and it is not null.
>
> if(connssl->handle) {
> system("echo reached_1 >> /file ");
> (void)SSL_shutdown(connssl->handle);
> system("echo reached_2 >> /file ");
> .
> .
> .
>
> I see "reached_1" getting printed, but not "reached_2" as the code crashes at SSL_shutdown.
> I tried using https://ipv4_address:443/.. instead of https://ipv6_address:443/... but it still crashes;
> difference being it crashes at 3001 th iteration instead of 1001th iteration for ipv6.
>
> I don't see any issues when I run the same code (url: https://ipv4_address:443/data) with the the following:
>
> linux kernel 2.4.20
> openSSL version: 0.9.7 static
>
> ==========
> Test Code:
> ==========
>
> int
> main(int nargs,
> char *args[])
> {
> CURL *curl_desc;
> FILE * pFile;
> int i=1;
>
> curl_desc = curl_easy_init();
>
> curl_easy_setopt(curl_desc, CURLOPT_FOLLOWLOCATION,1);
> curl_easy_setopt(curl_desc, CURLOPT_TIMEOUT, 60);
> curl_easy_setopt(curl_desc, CURLOPT_CONNECTTIMEOUT, 60);
> curl_easy_setopt(curl_desc, CURLOPT_FAILONERROR, 1);
> curl_easy_setopt(curl_desc, CURLOPT_USERPWD, "testuser123:Ph0enix08");
> curl_easy_setopt(curl_desc, CURLOPT_SSL_VERIFYPEER, 0);
> curl_easy_setopt(curl_desc, CURLOPT_SSL_VERIFYHOST, 0);
>
>
> while (1)
> {
> i++;
> pFile = fopen ("tmpfile","w");
>
> /* set options for a curl easy handle */
> curl_easy_setopt(curl_desc, CURLOPT_RANGE, "0-");
> curl_easy_setopt(curl_desc, CURLOPT_WRITEDATA, pFile);
> curl_easy_setopt(curl_desc, CURLOPT_URL, "https://fd86:8baa:b243:202::2023:443/data");
> curl_easy_perform(curl_desc);
>
> if ((i % 1000) == 1)
> sleep(600);
>
> fclose(pFile);
> }
>
> return 1;
>
> }
>
>
> Could someone please let me know if I am missing something here.
>
> Thanks,
> G
Received on 2009-09-23