indexing deadlock

Hi

I'm getting sporadic deadlocks in indexing with my plugin, and I'm not sure what am I doing wrong. Sequence of events from the thread dump:

 

F/J Pool 3/8 (#9159):

  • codeInsight.daemon.RelatedItemLineMarkerProvider.collectNavigationMarkers
  • CachedValuesManager.getParameterizedCachedValue => cache miss
  • CachedValueBase.getValueWithLock
  • Query.findAll, eventually hits StubIndexImpl.processAllKeys. This acquires MapReduceIndex read lock (re-entrant, right?)
  • (same) index.get, triggers index update. Can I safely do index.get inside processAllKeys?
  • locks on StubUpdatingIndex$MyIndex.updateWithMap trying to get MapReduceIndex write lock

 

F/J Pool 0/8 (#9156):

  • runAnnotators
  • CachedValuesManager.getParameterizedCachedValue => cache miss
  • Query.findAll
  • another Query.findAll
  • (inside application.runReadAction): AbstractStubIndex.get
  • StubIndexImpl.doProcessStubs tries to get a MapReduce read lock and gets stuck

 

AWT event thread: calculates line extensions and hits same index as 9156. (Any way to move it off of AWT?). Locks on StubIndexImpl.doProcessStubs too.

 

A group of similar threads (ApplicationImpl pooled threads 1494,1493,1492,1491):

  • FileBasedIndexImpl.indexFileContent
  • StubUpdatingIndex$MyIndex.updateWithMap, trying to get MapReduceIndex write lock

 

ApplicationImpl pooled thread 1489:

  • FileBasedIndexImpl.flushAllIndices => tries to acquire MapReduceIndex read lock

 

I don't see who's holding MapReduce index lock that blocks F/J thread 3/8

Source code here.

Thanks!

2 comments
Comment actions Permalink

The thread F/J Pool 3/8 doing processAllKeys holds index's read lock, it can not proceed with write lock later.
I filed issue https://youtrack.jetbrains.com/issue/IDEA-182151

As workaround do not access indices inside processAllKeys.

0
Comment actions Permalink

ah, I overlooked that R/W locks are not upgradable.. thanks!

0

Please sign in to leave a comment.