Skip to content

Commit 0aff21a

Browse files
abhinavdangetichiyoung
authored andcommitted
Address data race with blockcache's freelist_count
11:02:03 WARNING: ThreadSanitizer: data race (pid=108225) 11:02:03 Write of size 8 at 0x000001571768 by thread T14 (mutexes: write M57456, write M57552, write M14): 11:02:03 #0 _bcache_alloc_freeblock() /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/blockcache.cc:293 (fdb_functional_test+0x0000004e5a89) 11:02:03 couchbase#1 filemgr_read /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/filemgr.cc:1989 (fdb_functional_test+0x000000501a8b) 11:02:03 couchbase#2 _docio_read_through_buffer(docio_handle*, unsigned long, err_log_callback*, bool) /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/docio.cc:691 (fdb_functional_test+0x0000004faa70) 11:02:03 couchbase#3 docio_read_doc /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/docio.cc:1212 (fdb_functional_test+0x0000004fbb6f) 11:02:03 couchbase#4 fdb_kvs_header_read /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/kv_instance.cc:1123 (fdb_functional_test+0x00000053261c) 11:02:03 couchbase#5 _fdb_open /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/forestdb.cc:1954 (fdb_functional_test+0x00000050ac08) 11:02:03 couchbase#6 fdb_open /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/forestdb.cc:782 (fdb_functional_test+0x0000005090ba) 11:02:03 couchbase#7 _worker_thread(void*) crtstuff.c (fdb_functional_test+0x0000004d184b) 11:02:03 11:02:03 Previous read of size 8 at 0x000001571768 by thread T19: 11:02:03 #0 bcache_get_num_free_blocks /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/blockcache.cc:1410 (fdb_functional_test+0x0000004e7d64) 11:02:03 couchbase#1 _filemgr_prefetch_thread(void*) /home/couchbase/jenkins/workspace/forestdb-threadsanitizer-master/forestdb/src/filemgr.cc:612 (fdb_functional_test+0x0000004fe4da) Change-Id: Id7344ae6a13f97fb3bc6f8ed9140d1788e78fe72 Reviewed-on: http://review.couchbase.org/62377 Reviewed-by: Chiyoung Seo <[email protected]> Tested-by: buildbot <[email protected]>
1 parent 31dd798 commit 0aff21a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/blockcache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static spin_t bcache_lock;
5252
static struct hash fnamedic;
5353

5454
// free block list
55-
static volatile size_t freelist_count;
55+
static atomic_uint64_t freelist_count(0);
5656
static struct list freelist;
5757
static spin_t freelist_lock;
5858

0 commit comments

Comments
 (0)