Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is IntelliJ IDEA hanging on "Indexing"?

I'm running on Arch Linux, on an i7-5930k 6 core CPU and 64GB of DDR4 RAM, and I'm using IntelliJ IDEA 14.

IDEA was working just fine for me several days ago, but one day, suddenly, it began hanging after opening a project, during the "Indexing" stage. I did not update IDEA and nothing changed about my projects. The IDE's UI hangs after it opens the project, with just a tiny little sliver of the progress bar for "Indexing" complete. Every 5-10 minutes or so it unfreezes and the progress bar crawls forward a little bit, before the IDE freezes again for another few minutes. This happens repeatedly for anywhere between 15 minutes and an hour, until it is finally finished indexing, at which point it hangs for another 5-10 minutes doing nothing, before it finally unlocks and allows me to develop.

While this is happening, my system is fairly unresponsive - Firefox tabs take a long time to switch, and scrolling in them is laggy. Opening a new terminal window takes a long time. Switching windows in general takes awhile. In htop, one of my CPU cores is loaded at 100% while the rest have a normal load, and about 6GB of RAM is used (fairly normal load when this system is idle.)

Things I have tried that have not helped:

  • Delete caches folder
  • Delete entire ~/.IntelliJIDEA14 folder
  • Reinstall IntelliJ package
  • Download IntelliJ manually from JetBrains' site and run it from my Downloads folder (to see if there was something wrong with the Arch AUR package)
  • Configure IntelliJ to use my system JVM and Maven for importing instead of its embedded tools
  • Opening multiple different projects (not just the one I initially experienced the issue on.)

This issue is really hurting my workflow, if anybody has any solution to this I would be very greatful.

like image 674
AppleDash Avatar asked Sep 13 '15 13:09

AppleDash


People also ask

Why does IntelliJ indexing take so long?

If indexing takes a significant amount of time, then it's likely that your project has more than two modules. Normally, you don't need all of them at same time. If this is the case, you can temporarily set aside (unload) the modules that you don't need right now.

How do I stop IntelliJ from indexing all the time?

Just Go to: File -> Setting -> Directories. Stop all the files that are going to included and need to empty ADD Content Root.

How do I fix my IntelliJ IDEA?

From the main menu, select File | Repair IDE. IntelliJ IDEA will automatically launch the first recovery step and refresh the virtual file system. IntelliJ IDEA will display a notification that you can use to continue or complete the recovery process.


2 Answers

Try Invalidating the cache and restarting IntelliJ.

In the File menu, select Invalidate Caches / Restart... and then click the Invalidate and Restart button.

like image 62
Motti Avatar answered Oct 06 '22 00:10

Motti


I've finally figured it out. The solution was... Rather odd. TL;DR: Run it under strace. Read on for a more detailed explanation.

I came upon it when I decided to run IntelliJ under strace to see what files it was opening to determine whether or not it was a filesystem bottleneck.

This gave me some very strange results: strace was spewing out a near-constant stream of segfaults. Not only that, but IntelliJ was running just fine, not taking forever to index.

After consulting with a friend, I learned that on Arch Linux, systemd logs a dump of a process's memory every time a segfault occurs, except when a debugger is attached. strace is considered a debugger. Arch was thrashing my disks when it kept logging memory dumps due to all the segfaults, hence why the indexing was taking so long, because it was fighting for disk I/O.

My solution for now is to simply run IntelliJ under strace. I will, however, be looking into the issue further, as I don't think java should be segfaulting that much.

like image 44
AppleDash Avatar answered Oct 05 '22 23:10

AppleDash