cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL_shutdown crashes

From: Ganesh Ragavan <ganeshragavan_at_gmail.com>
Date: Mon, 21 Sep 2009 10:51:02 -0700

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

Please let me know what could be the problem.

Regards,
G

On Fri, Sep 18, 2009 at 12:14 PM, Ganesh Ragavan
<ganeshragavan_at_gmail.com> wrote:
> Daniel,
>
> Thanks for the reply.  I am using Linux (2.6.18).
>
> openSSL version: 0.9.8, static
> I see the same problem with 7.19.6 as well.
>
> I shall try to see the SSL_shutdown() input value.
>
> ~G
>
>
>>So this is 7.18.2 on Windows? What OpenSSL version? Using OpenSSL static or
>>DLL?
>
>>Two ideas:
>>
>  >1 - try 7.19.6 and see if that shows the same problem
>  >
>  >2 - set a break-point in the library and run with a debugger and check
>  >  what libcurl passes as input to SSL_shutdown()
>
> On Thu, Sep 17, 2009 at 8:37 PM, Ganesh Ragavan <ganeshragavan_at_gmail.com> wrote:
>> Sorry, forgot to mention:
>> #define CD_TIMEOUT_VALUE_SEC 60
>>
>> On Thu, Sep 17, 2009 at 5:44 PM, Ganesh Ragavan <ganeshragavan_at_gmail.com> wrote:
>>> 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.18.2\lib\ssluse.c
>>> function :   void Curl_ossl_close(struct connectdata *conn, int sockindex)
>>> line:          (void)SSL_shutdown(connssl->handle);
>>>
>>>
>>> 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, CD_TIMEOUT_VALUE_SEC);
>>>        curl_easy_setopt(curl_desc, CURLOPT_CONNECTTIMEOUT, CD_TIMEOUT_VALUE_SEC);
>>>        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-21