From 93509133add8c4a2b2796d3b6587173aff7aef98 Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Fri, 26 May 2017 10:47:37 -0700 Subject: [PATCH] =?UTF-8?q?Attempt=20to=20eliminate=20a=20race=20in=20DLSi?= =?UTF-8?q?ngleAssignmentVar=20between=20cancelling=20a=20future=20and=20c?= =?UTF-8?q?hecking=20its=20ref=20count.=20Reduce=20the=20amount=20of=20ite?= =?UTF-8?q?rations=20in=20the=20test=20because=20it=E2=80=99s=20timing=20o?= =?UTF-8?q?ut=20on=20the=20pie=20workers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fdbclient/MultiVersionTransaction.actor.cpp | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/fdbclient/MultiVersionTransaction.actor.cpp b/fdbclient/MultiVersionTransaction.actor.cpp index b5685932ab..daad55dd77 100644 --- a/fdbclient/MultiVersionTransaction.actor.cpp +++ b/fdbclient/MultiVersionTransaction.actor.cpp @@ -1522,14 +1522,24 @@ THREAD_FUNC cancel(void *arg) { ACTOR Future checkUndestroyedFutures(std::vector*> undestroyed) { state int fNum; + state ThreadSingleAssignmentVar* f; + state double start = now(); + for(fNum = 0; fNum < undestroyed.size(); ++fNum) { - state ThreadSingleAssignmentVar* f = undestroyed[fNum]; - state double start = now(); - while(!f->isReady()) { - ASSERT(now() < start+60); - Void _ = wait(delay(5.0)); + f = undestroyed[fNum]; + + while(!f->isReady() && start+5 >= now()) { + Void _ = wait(delay(1.0)); } + ASSERT(f->isReady()); + } + + Void _ = wait(delay(1.0)); + + for(fNum = 0; fNum < undestroyed.size(); ++fNum) { + f = undestroyed[fNum]; + ASSERT(f->debugGetReferenceCount() == 1); ASSERT(f->isReady()); @@ -1545,7 +1555,7 @@ THREAD_FUNC runSingleAssignmentVarTest(void *arg) { volatile bool *done = (volatile bool*)arg; try { - for(int i = 0; i < 100; ++i) { + for(int i = 0; i < 25; ++i) { FutureInfo f = createVarOnMainThread(false); FutureInfo tf = T::createThreadFuture(f); tf.validate(); @@ -1553,7 +1563,7 @@ THREAD_FUNC runSingleAssignmentVarTest(void *arg) { tf.future.extractPtr(); // leaks } - for(int numRuns = 0; numRuns < 100; ++numRuns) { + for(int numRuns = 0; numRuns < 25; ++numRuns) { std::vector*> undestroyed; std::vector threads; for(int i = 0; i < 10; ++i) {