diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index a402139449cf..2861cb50a274 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -1210,6 +1210,10 @@ public class FileBasedIndexImpl extends FileBasedIndex { @Nullable public static Throwable getCauseToRebuildIndex(@NotNull RuntimeException e) { + if (ApplicationManager.getApplication().isUnitTestMode()) { + // avoid rebuilding index in tests since we do it synchronously in requestRebuild and we can have readAction at hand + return null; + } if (e instanceof IndexOutOfBoundsException) return e; // something wrong with direct byte buffer Throwable cause = e.getCause(); if (cause instanceof StorageException || cause instanceof IOException ||