You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2022/07/25 22:50:05 UTC
[couchdb] branch cpse-incref-decref-wait created (now 94290054b)
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a change to branch cpse-incref-decref-wait
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at 94290054b Address race in cpse_incref_decref test
This branch includes the following new commits:
new 94290054b Address race in cpse_incref_decref test
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Address race in cpse_incref_decref test
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch cpse-incref-decref-wait
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 94290054b35877a034930026a49c84a3c4021f6e
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Jul 25 15:05:45 2022 -0700
Address race in cpse_incref_decref test
Occasionally, this test fails with the following stack trace:
cpse_gather: make_test_fun (cpse_incref_decref)...*failed*
in function cpse_test_ref_counting:'-cpse_incref_decref/1-fun-0-'/2 (src/cpse_test_ref_counting.erl, line 44)
in call from cpse_test_ref_counting:cpse_incref_decref/1 (src/cpse_test_ref_counting.erl, line 44)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
in call from eunit_proc:run_test/1 (eunit_proc.erl, line 522)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 347)
in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 505)
in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 447)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 337)
**error:{assert,[{module,cpse_test_ref_counting},
{line,44},
{expression,"lists : member ( Pid , Pids1 )"},
{expected,true},
{value,false}]}
output:<<"">>
Wrap the former assertion in a `test_util:wait` call to account for
the apparent race between client readiness and
`couch_db_engine:monitored_by/1`.
---
src/couch_pse_tests/src/cpse_test_ref_counting.erl | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/couch_pse_tests/src/cpse_test_ref_counting.erl b/src/couch_pse_tests/src/cpse_test_ref_counting.erl
index a0123d1ca..e56321080 100644
--- a/src/couch_pse_tests/src/cpse_test_ref_counting.erl
+++ b/src/couch_pse_tests/src/cpse_test_ref_counting.erl
@@ -40,8 +40,15 @@ cpse_incref_decref({Db, _}) ->
{Pid, _} = Client = start_client(Db),
wait_client(Client),
- Pids1 = couch_db_engine:monitored_by(Db),
- ?assert(lists:member(Pid, Pids1)),
+ test_util:wait(
+ fun() ->
+ MonitoredPids1 = couch_db_engine:monitored_by(Db),
+ case lists:member(Pid, MonitoredPids1) of
+ true -> ok;
+ false -> wait
+ end
+ end
+ ),
close_client(Client),