Permalink
Browse files

Fix deadlock stopping merge distribute

If merge dist stopped early, it could deadlock, because it failed
to signal a pending semaphore
Also start didn't reset stopping flag which could cause problems if in child
queries

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
  • Loading branch information...
1 parent 681addc commit 230d79e15375db7799f373fd7c3c0861d1232802 @jakesmith jakesmith committed Jan 23, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 thorlcr/activities/hashdistrib/thhashdistribslave.cpp
@@ -1338,7 +1338,10 @@ class CRowPullDistributor: public CDistributorBase
assertex(!donerecv[i]);
if (self==i) {
if (stopping)
+ {
+ selfdone.signal();
return (unsigned)-1;
+ }
if (hasbuf[i]) {
bufs[i].swapWith(msg);
cBuf *cb = diskcached[i];
@@ -1425,6 +1428,7 @@ class CRowPullDistributor: public CDistributorBase
}
void startTX()
{
+ stopping = false;
delete txthread;
txthread = new cTxThread(*this);
txthread->start();

0 comments on commit 230d79e

Please sign in to comment.