dealing with nested indices processing



My plugin had sporadic lockups during indexing, now I'm getting some helpful diagnostic from 2017.2 about nested indices processing, however I don't understand what exactly is happening.  Here are a couple of examples from the stacktraces:

  • code insight calls line marker provider which tries to figure out types hierarchy
  • CachedValueManager on a type def PSI element gets a cache miss and goes to
  • StubIndexImpl.processAllKeys (project, closure)
  • closure calls AbstractStubIndex.get
  • IndexAccessValidator.checkAccessingIndexDuringOtherIndexProcessing -> boom

another one

  • highlighter calls annotator
  • annotator tries to resolve a reference, ResolveCache gets a miss and calls a resolver
  • resolve does another index scan and eventually lands in StubIndexImpl.processAllKeys
  • the rest is the same

So what am I doing wrong? I don't see any nested index processing here.



It looks like a problem in detection of nested index access: StubIndexImpl.processAllKeys counts as stub index access and "closure calls AbstractStubIndex.get" is another (but same) index access