cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multithread curl. unexpected SIGSEGV

From: Azat Khuzhin <dohardgopro_at_gmail.com>
Date: Mon, 17 Sep 2012 17:12:27 +0400

On Mon, Sep 17, 2012 at 4:58 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 17 Sep 2012, Azat Khuzhin wrote:
>
>> I have SIGSEGV when I run curl in 400 threads. valgrind doesn't detect any
>> memory errors.
>>
>> I can't post here all program sources, but here is some info:
>
>
> You shouldn't post "all program sources" - because we don't want them. You
> should write a new stand-alone example that repeats your problem and then
> post _that_ source code.
>
> If you can reproduce the problem in a separate application, chances are the
> problem is in your code.

I don't think that this justified, but I try when I have more time.
Because this application crawl URL's and source code is not enough to
reproduce this error, also you need URL's (I think that ~5 million
rows should be enough.)
>
>
>> At all time program runs, only one valgrind message (valgrind
>> --show-reachable=yes --leak-check=full) :
>> ==30908== Thread 3:
>> ==30908== Conditional jump or move depends on uninitialised value(s)
>> ==30908== at 0x4C2B837: __GI___rawmemchr (mc_replace_strmem.c:1110)
>> ==30908== by 0x532A2AF: _IO_str_init_static_internal (strops.c:45)
>> ==30908== by 0x531E9D4: vsscanf (iovsscanf.c:44)
>> ==30908== by 0x530AB97: sscanf (sscanf.c:34)
>> ==30908== by 0x4074E9: parseUrl (crawler.c:28)
>> ==30908== by 0x407961: startRoutine (crawler.c:125)
>> ==30908== by 0x4E35B4F: start_thread (pthread_create.c:304)
>> ==30908== by 0x538D70C: clone (clone.S:112)
>
>
> ... this has nothing to do with libcurl but rather shows a problem in your
> application.

I know, but it seems that this is not important error
>
>
>> And it caught SIGSEGV:
>> ==30908== Process terminating with default action of signal 11 (SIGSEGV)
>> ==30908== General Protection Fault
>> ==30908== at 0x50926C8: curl_slist_free_all (in
>> /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
>> ==30908== by 0x4031AF: curlSetOptionPC (curl.c:138)
>> ==30908== by 0x407CB2: startRoutine (crawler.c:185)
>> ==30908== by 0x4E35B4F: start_thread (pthread_create.c:304)
>> ==30908== by 0x538D70C: clone (clone.S:112)
>
>
> This could just as well be a thread/synch problem in your application. If
> you look at the curl_slist_free_all() implementation you'll see that it
> doesn't have a lot of logic that can go wrong.

Every thread have it own curl handler.
At this moment I run my application under "valgrind --tool=drd" but
pthread_create is very slow under this tool,
so if I found some thing important/interesting I post here.
>
>
>> Also valgrind show that Curl_ssl_connect is called (how ? If I allow only
>> HTTP protocol)
>
>
> That seems strange yes and I can't explain it. Can't you just set a
> break-point and see how it gets there?

It's a good idea. I give it a try and post here results when find something.

Thanks for reply.
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-- 
Azat Khuzhin
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-17