cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1904848 ] EXC_BAD_ACCESS

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 29 Feb 2008 13:14:52 -0800

Bugs item #1904848, was opened at 2008-02-29 18:38
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1904848&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: crash
Status: Open
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Jonathan Zdziarski (jzdziarski)
Assigned to: Daniel Stenberg (bagder)
Summary: EXC_BAD_ACCESS

Initial Comment:
Running libcurl in a multithreaded environment, once in a great while I end up with this backtrace. Any help / workaround would be appreciated. This is built with c-ares on Mac OSX Leopard 10.5

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc0000003
[Switching to process 71385 thread 0x2d2b]
0x9529d525 in pid_cmp ()
(gdb) bt
#0 0x9529d525 in pid_cmp ()
#1 0x95253353 in getrn ()
#2 0x95254063 in lh_retrieve ()
#3 0x9529ceb5 in int_thread_get_item ()
#4 0x9529d5af in ERR_get_state ()
#5 0x9529d9a3 in ERR_clear_error ()
#6 0x96391731 in ssl3_connect ()
#7 0x00067730 in ossl_connect_common ()
#8 0x0006856d in Curl_ossl_connect ()
#9 0x00057942 in Curl_http_connect ()
#10 0x000626db in Curl_protocol_connect ()
#11 0x000648bf in SetupConnection ()
#12 0x00064a6f in Curl_async_resolved ()
#13 0x0006ffa4 in Curl_perform ()
#14 0x000031b5 in process_url (CTX=0x1d25bf40, url=0x1d1f1e90) at phishd.c:452
#15 0x00003560 in process_site (ptr=0x1d25bf40) at phishd.c:355
#16 0x900f0c55 in _pthread_start ()
#17 0x900f0b12 in thread_start ()
(gdb)

The code I'm using to call libcurl is in each individual thread:

   curl = curl_easy_init();
    if (!curl) {
        LOG(LOG_CRIT, ERR_CURL_INIT_FAIL, strerror(errno));
        return EINVAL;
    }

    buffer.data = NULL;
    buffer.len = 0;

    slist = curl_slist_append(slist,
        "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
    slist = curl_slist_append(slist, "Cache-Control: max-age=0");
    slist = curl_slist_append(slist, "Accept-Language: en-us,en;q=0.5");
    slist = curl_slist_append(slist, "Accept-Encoding: ");
    slist = curl_slist_append(slist,
        "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
    slist = curl_slist_append(slist,
       "Accept: text/xml,application/xml,application/xhtml+xml,text/html;"
       "q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");

    curl_easy_setopt(curl, CURLOPT_URL, url->url);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10);
    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5);
    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
    curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
    curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);

    res = curl_easy_perform(curl);
    curl_slist_free_all(slist);
    if (res == CURLE_OK)
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpcode);
    curl_easy_cleanup(curl);

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2008-02-29 22:14

Message:
Logged In: YES
user_id=1110
Originator: NO

This is rather a crash in openssl. Are you using the proper OpenSSL
callbacks for multithreaded use?

like this: http://curl.haxx.se/lxr/source/docs/examples/threaded-ssl.c

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1904848&group_id=976
Received on 2008-02-29

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET