You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/12/09 21:03:03 UTC

[GitHub] [geode] agingade commented on a change in pull request #5823: GEODE-8771: invalidate should acquire the lock before initIndex

agingade commented on a change in pull request #5823:
URL: https://github.com/apache/geode/pull/5823#discussion_r539645325



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
##########
@@ -1282,14 +1282,18 @@ public boolean invalidate(EntryEventImpl event, boolean invokeCallbacks, boolean
     DiskRegion dr = owner.getDiskRegion();
     boolean ownerIsInitialized = owner.isInitialized();
 
+    // lock before waitForIndexInit so that we should wait
+    // till a concurrent clear to finish
+    lockForCacheModification(owner, event);

Review comment:
       @jchen21 
   There is locking mechanism to co-ordinate between cache modification (index maintenance) and index initialization. During index initialization all the cache operations are blocked.
   As part of index management; clear invokes index re-initialization. 
   Also, during clear no cache operations are allowed; this is co-ordinated through lockForCacheModification (version lock).
   The hang is observed due to:
   Thread1 calling update, which blocks index initialization.
   Thread2 calling clear, takes the cache modification lock, this blocks all cache operation; and clear triggers index re-initialization; this is now blocked for thread1 to finish update. But thread1 is waiting for cache modification lock which is held by thread2; resulting in dead-lock.
   
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org