couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couch commit: updated refs/heads/master to acfd7cb
Date Mon, 19 Oct 2015 08:08:44 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master 79b5243ae -> acfd7cb0c


Fix race condition in workqueue test.

Failure seen at least once in about 150 test runs:

```
Queue with max size of 160 bytes and 3 max items
 couch_work_queue_tests:143: should_have_no_items_for_new_queue...ok
**error:{assertEqual_failed,[{module,couch_work_queue_tests},
                     {line,210},
                     {expression,"couch_work_queue : item_count ( Q )"},
                     {expected,3},
                     {value,2}]}
```

From

```
should_block_producer_on_full_queue_count({Q, Producer, _}) ->
    ...
    produce(Q, Producer, 20, false),
    ?assertEqual(3, couch_work_queue:item_count(Q)),
```

Race condition is: telling Producer to produce, not waiting
for queue size to be updated, and then immediately checking
item_count.

To make failure occur reliably insert timer:sleep(10) in
producer_loop after ```Parent ! {item, Ref, Item}``` line.

The fix is to wait for queue size to be updated by using
the wait mode for produce function.

COUCHDB-2848


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/acfd7cb0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/acfd7cb0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/acfd7cb0

Branch: refs/heads/master
Commit: acfd7cb0c709345f396cbcb696b6305091dfac12
Parents: 79b5243
Author: Nick Vatamaniuc <vatamane@gmail.com>
Authored: Mon Oct 19 02:05:46 2015 -0400
Committer: Nick Vatamaniuc <vatamane@gmail.com>
Committed: Mon Oct 19 02:05:46 2015 -0400

----------------------------------------------------------------------
 test/couch_work_queue_tests.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/acfd7cb0/test/couch_work_queue_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_work_queue_tests.erl b/test/couch_work_queue_tests.erl
index 96be7da..4f81013 100644
--- a/test/couch_work_queue_tests.erl
+++ b/test/couch_work_queue_tests.erl
@@ -206,7 +206,7 @@ should_block_producer_on_full_queue_count({Q, Producer, _}) ->
     ?assertEqual(2, couch_work_queue:item_count(Q)),
     ok = ping(Producer),
 
-    produce(Q, Producer, 20, false),
+    produce(Q, Producer, 20, true),
     ?assertEqual(3, couch_work_queue:item_count(Q)),
     Pong = ping(Producer),
 


Mime
View raw message