This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-8475
in repository https://gitbox.apache.org/repos/asf/geode.git

commit a706dfd42757e2994621ec9fa5bd189c5e4d759e
Author: zhouxh <[email protected]>
AuthorDate: Mon Aug 31 23:33:30 2020 -0700

    GEODE-8475: Resolve a potential dead lock in ParallelGatewaySenderQueue
    
        Co-authored-by: Darrel Schneider <[email protected]>
---
 .../internal/cache/wan/parallel/ParallelGatewaySenderQueue.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
 
b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index 1a18d8d..a44feb7 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -755,12 +755,16 @@ public class ParallelGatewaySenderQueue implements 
RegionQueue {
                 bucketFullPath, brq);
           }
           if (brq != null) {
+            boolean intializingLocked = brq.lockWhenRegionIsInitializing();
             brq.getInitializationLock().readLock().lock();
             try {
               putIntoBucketRegionQueue(brq, key, value);
               putDone = true;
             } finally {
               brq.getInitializationLock().readLock().unlock();
+              if (intializingLocked) {
+                brq.unlockWhenRegionIsInitializing();
+              }
             }
           } else if (isDREvent) {
             // in case of DR with PGS, if shadow bucket is not found event 
after
@@ -800,12 +804,16 @@ public class ParallelGatewaySenderQueue implements 
RegionQueue {
                 brq = (AbstractBucketRegionQueue) prQ.getCache()
                     .getInternalRegionByPath(bucketFullPath);
                 if (brq != null) {
+                  boolean intializingLocked = 
brq.lockWhenRegionIsInitializing();
                   brq.getInitializationLock().readLock().lock();
                   try {
                     putIntoBucketRegionQueue(brq, key, value);
                     putDone = true;
                   } finally {
                     brq.getInitializationLock().readLock().unlock();
+                    if (intializingLocked) {
+                      brq.unlockWhenRegionIsInitializing();
+                    }
                   }
                 } else {
                   tempQueue.add(value);

Reply via email to