cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Intel(R) Thread Checker report

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 21 Jun 2007 09:24:18 +0200 (CEST)

On Thu, 21 Jun 2007, Gerrit Bruchhäuser wrote:

> Simultaniously allowing threads to enter 'curl_easy_setopt' (with different
> easy_handles) produced the following report:
>
> Read -> Write data-race Error "url.c":233
> Memory write at "url.c":379 conflicts with a prior memory read
> at "url.c":1595 (anti dependence) "url.c":1595 "url.c":379

The line 379 seems like an obvious bug, indeed. See patch below. It accesses
the share without locking it first.

The line 1595 however I can't see how it can be a bug. Can you?

This is my suggested patch for the line 379 problem (it has moved slightly in
the latest CVS):

diff -u -r1.620 url.c
--- lib/url.c 5 Jun 2007 13:41:50 -0000 1.620
+++ lib/url.c 21 Jun 2007 07:23:08 -0000
@@ -378,8 +378,11 @@
  #endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */

    /* No longer a dirty share, if it exists */
- if (data->share)
+ if (data->share) {
+ Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
      data->share->dirty--;
+ Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
+ }

    free(data);
    return CURLE_OK;

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-06-21