cURL / Mailing Lists / curl-library / Single Mail

curl-library

Helgrind errors with multi-threaded libcurl

From: <leoakr_at_uth.gr>
Date: Thu, 09 Dec 2010 17:22:07 +0200

Hello

I am using libcurl easy to connect simultaneously to four search engines
(Google, Yahoo, Bing and Ask) to submit requests. My program is based on the
example mentioned here http://curl.haxx.se/libcurl/c/multithread.html

The program runs fine, it never crashes, it does not leak memory and the
memcheck tool of Valgrind does not report any errors during execution. However,
the Helgrind tool keeps producing hundreds of "data race condition" errors. The
two functions which seem to be problematic are _nss_dns_gethostbyname3_r and
getanswer_r. All the produced errors concern these functions. I am using the
64-bit version of Ubuntu 10.04 and the compiler is linked to
/usr/lib/libcurl.so.4.

Below I am reporting only two such helgrind errors (the others are similar)

==3827== Possible data race during read of size 1 at 0xbeff358 by thread #6
==3827== at 0xBEFF358: _nss_dns_gethostbyname3_r (dns-host.c:239)
==3827== by 0xBEFF5C3: _nss_dns_gethostbyname2_r (dns-host.c:251)
==3827== by 0x5D01C32: gaih_inet (getaddrinfo.c:769)
==3827== by 0x5D03831: getaddrinfo (getaddrinfo.c:2160)
==3827== by 0x4E68481: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E63C61: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E3951B: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E396EA: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E4DBA4: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E4DD4D: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E59C9F: ??? (in /usr/lib/libcurl.so.4.1.1)

==3827== Possible data race during read of size 1 at 0xbefe272 by thread #5
==3827== at 0xBEFE272: getanswer_r (dns-host.c:763)
==3827== by 0xBEFF355: _nss_dns_gethostbyname3_r (dns-host.c:237)
==3827== by 0xBEFF5C3: _nss_dns_gethostbyname2_r (dns-host.c:251)
==3827== by 0x5D01C32: gaih_inet (getaddrinfo.c:769)
==3827== by 0x5D03831: getaddrinfo (getaddrinfo.c:2160)
==3827== by 0x4E68481: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E63C61: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E3951B: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E396EA: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E4DBA4: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E4DD4D: ??? (in /usr/lib/libcurl.so.4.1.1)
==3827== by 0x4E59C9F: ??? (in /usr/lib/libcurl.so.4.1.1)

What am I doing wrong? Could you please help me?

Thanks a lot.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-09