Indexing fails : Multiple times needs to start Intellij

Issue #2203 resolved
Nagendra Singh created an issue

This has started happening frequently nowadays, where indexing gets stuck almost 4-5 times when I open Intellij IDE.

I can see in logs this getting printed. `2022-09-22 07:42:20,373 [ 16567] SEVERE - #c.i.u.i.FileBasedIndexImpl - Plugin to blame: Illuminated Cloud 2 version: 2.2.3.6`

IntelliJ IDEA 2022.2.2 (Ultimate Edition)
Build #IU-222.4167.29, built on September 13, 2022
Runtime version: 17.0.4+7-b469.53 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Non-Bundled Plugins:
com.intellij.selenium (222.4167.21)
Pythonid (222.4167.37)
com.illuminatedcloud2.intellij (2.2.3.6)
com.haulmont.jpab (2022.4.1-222)

Kotlin: 222-1.7.10-release-334-IJ4167.29

Please let me know if you need any more info from my end.

Comments (17)

  1. Scott Wells repo owner

    I do see several of these in the provided log:

    2022-09-22 07:42:23,176 [  19370] SEVERE - #c.i.u.i.FileBasedIndexImpl - Error while indexing ...\<FilenameName>.cls
    To reindex this file IDEA has to be restarted
    java.lang.AssertionError: Reentrant indexing
        at com.intellij.util.indexing.FileBasedIndexImpl.markFileIndexed(FileBasedIndexImpl.java:1726)
        ...
        at com.illuminatedcloud.intellij.psi.util.ApexDeclarationUtil.slowFindTypeDeclaration(SourceFile:579)
        at com.illuminatedcloud.intellij.psi.util.ApexDeclarationUtil.slowFindTypeDeclaration(SourceFile:532)
        at com.illuminatedcloud.intellij.psi.util.ApexDeclarationUtil.slowFindTypeDeclaration(SourceFile:532)
        at com.illuminatedcloud.intellij.psi.util.ApexDeclarationUtil.findTypeDeclaration(SourceFile:163)
        at com.illuminatedcloud.intellij.psi.util.ApexDeclarationUtil.findTypeDeclaration(SourceFile:102)
        at com.illuminatedcloud.intellij.psi.impl.ApexTypeMixin.lambda$getExpressionType$0(SourceFile:170)
        ...
        at com.illuminatedcloud.intellij.psi.impl.ApexTypeMixin.getExpressionType(SourceFile:112)
        at com.illuminatedcloud.intellij.psi.impl.ApexMethodDeclarationMixin.doGetExpressionType(SourceFile:108)
        at com.illuminatedcloud.intellij.psi.impl.ApexInvokableDeclarationMixin.buildSignature(SourceFile:93)
        at com.illuminatedcloud.intellij.psi.impl.ApexInvokableDeclarationMixin.getSignature(SourceFile:62)
        at com.illuminatedcloud.intellij.psi.stub.ApexInvokableDeclarationStub.<init>(SourceFile:28)
        at com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationStub.<init>(SourceFile:21)
        at com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationElementType.doCreateStub(SourceFile:31)
        at com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationElementType.doCreateStub(SourceFile:15)
        at com.illuminatedcloud.intellij.psi.stub.ApexDeclarationStubElementType.createStub(SourceFile:174)
        at com.illuminatedcloud.intellij.psi.stub.ApexMethodDeclarationElementType.createStub(SourceFile:15)
    

    I’ve also seen those occasionally locally and it’s definitely on my TODO list, but I’ve not seen any negative effects as it seems to resolve quickly. It seems to be due to something that’s changed in the base JetBrains IDE, though it may just be that it exposed an issue that was already there more explicitly. Are you seeing errant behavior in conjunction with this message, or are you just concerned about the message itself? Also, have you tried a full index rebuild using File>Invalidate Caches?

  2. Nagendra Singh reporter

    Its not a blocker, for sure. But the only issue is I have to restart intellij multiple times, because the whole console gets stuck. So I cannot do File > Invalidate Caches. After restarting intellij for 4-5 times, it works. But that restarting part makes it frustrating.

    Also as the problem seems to be with new files only, it seems like everytime a new file is added to org, I will have to do a full offline symbol table generation so that the indexing works.

  3. Scott Wells repo owner

    Maybe not a blocker but certainly far from ideal. I wonder what’s going on here that’s different from what I’m seeing and (presumably) from what others are seeing. I’ve not heard about this from other folks, though that doesn’t mean it’s not happening to them. The last part you describe where new files are added and that seems to trigger this behavior is particularly odd. I do that several times each day, and each time I just see the IDE index the newly retrieved files.

    Do you mind attaching the .iml file for this project so I can take a look at it? I wonder if perhaps the content/source roots are set up in a way that might be exacerbating this.

  4. Scott Wells repo owner

    Yes, that’s another instance of the same issue. Basically that occurs anytime the logic required to build one index relies on information from another index that isn’t guaranteed to be fresh already. So while the message is the same, the root cause is not. The one referenced in the linked issue was properly resolved at the time. I just neglected to circle back and resolve the item in the issue tracker.

    Thanks for providing your .iml file. It looks totally fine, so that’s not the issue. I’m just about to get this week’s build out and will then spend a bit of time investigating the instance of this issue that’s plaguing you right now. I may provide a test build here for you to try if I feel like I’ve created a proper fix.

  5. Nagendra Singh reporter

    Sure, will wait for your test build. BTW, I have been using your plugin for like years now. Its really awesome.

  6. Scott Wells repo owner

    I’m glad to hear that you continue to enjoy the product! I will dig into this behavior at the beginning of next week and keep you posted on what I find.

  7. Scott Wells repo owner

    Okay, this is a build that's pretty much 2.2.3.7 but with an attempted fix for (or more accurately, graceful recovery from) the reentrant indexing situation. Please install it using Settings / Preferences > Plugins > Install plugin from disk (under the gear drop-down menu), allow the IDE to restart, and let me know if it doesn't help. Either way I'd be interested to see your idea.log* files from after using it for a bit as I'm logging diagnostic info around the attempted recovery.

  8. Scott Wells repo owner

    Thanks. Yes, I actually have a more comprehensive change that I’m testing now. If all goes well, I plan to include it in tomorrow morning’s build. Sorry, I should have provided an update here for you.

  9. Scott Wells repo owner

    Okay, the prospective fix I have for this still has one issue during broad testing. I feel confident that I can take care of it, but it’s not going to be ready for tomorrow’s build. Once I feel it’s in good shape, I’ll attach it here for you to try as well, and if things go smoothly from there, I’ll plan to include it in next week’s build.

  10. Scott Wells repo owner

    I actually did get what I hope to be the full fix for this into 2.2.3.8. Can you please let me know if you still see it after updating?

  11. Nagendra Singh reporter

    Sure will let you know with the latest build. Just on a high level, was it related to the offline Symbol table?

  12. Scott Wells repo owner

    No, not really. It could happen a result of OST generation, but only because that results in reindexing which could include the reentrant indexing problem.

  13. Log in to comment