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

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 92978bd4ca1c883944a6cb3966867e2a8797606a
Author: Peeyush Gupta <[email protected]>
AuthorDate: Wed May 15 16:10:09 2024 -0700

    [ASTERIXDB-3400][IDX] Possible deadlock in GlobalVirtualBufferCache
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Change-Id: Ib9794c716772536336f1ed8112519e174fe02fd9
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18295
    Reviewed-by: Murtadha Hubail <[email protected]>
    Tested-by: Peeyush Gupta <[email protected]>
---
 .../asterix/common/context/GlobalVirtualBufferCache.java      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
index 0bb9bd5f79..156573013c 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
@@ -173,13 +173,16 @@ public class GlobalVirtualBufferCache implements 
IVirtualBufferCache, ILifeCycle
             // 2. there are still some active readers and memory cannot be 
reclaimed.
             // But for both cases, we will notify all primary index op 
trackers to let their writers retry,
             // if they have been blocked. Moreover, we will check whether more 
flushes are needed.
+            List<ILSMOperationTracker> opTrackers = new ArrayList<>();
             synchronized (this) {
                 final int size = primaryIndexes.size();
                 for (int i = 0; i < size; i++) {
-                    ILSMOperationTracker opTracker = 
primaryIndexes.get(i).getOperationTracker();
-                    synchronized (opTracker) {
-                        opTracker.notifyAll();
-                    }
+                    
opTrackers.add(primaryIndexes.get(i).getOperationTracker());
+                }
+            }
+            for (ILSMOperationTracker opTracker : opTrackers) {
+                synchronized (opTracker) {
+                    opTracker.notifyAll();
                 }
             }
             checkAndNotifyFlushThread();

Reply via email to