فهرست منبع

Merge pull request #7787 from jakesmith/hpcc-14190

HPCC-14190 Avoid possible deadlock during node subscription removal

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 9 سال پیش
والد
کامیت
f6efdb36ee
1فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 5 2
      dali/base/dasds.cpp

+ 5 - 2
dali/base/dasds.cpp

@@ -2796,6 +2796,11 @@ public:
     }
     virtual void remove(SubscriptionId id)
     {
+        /* important to ensure have exclusive data lock on removal, ahead of subscriber lock
+         * as can get notifications whilst holding data lock, e.g. notifyDelete on node destruction.
+         */
+        CHECKEDDALIREADLOCKBLOCK(owner.dataRWLock, readWriteTimeout);
+        CHECKEDCRITICALBLOCK(owner.treeRegCrit, fakeCritTimeout);
         CriticalBlock b(lock);
         /* calls back out to owner to protect root/treereg.
          * It calls back into removeSubscriberAssociation.
@@ -8630,8 +8635,6 @@ void CCovenSDSManager::addNodeSubscriber(ISubscription *sub, SubscriptionId id)
 
 void CCovenSDSManager::removeNodeSubscriber(SubscriptionId id)
 {
-    CHECKEDDALIREADLOCKBLOCK(dataRWLock, readWriteTimeout);
-    CHECKEDCRITICALBLOCK(treeRegCrit, fakeCritTimeout);
     nodeSubscriptionManager->removeSubscriberAssociation(id);
 }