Why is IntelliJ IDEA hanging on "Indexing"?
Asked Answered
M

27

86

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 grateful.

Milker answered 13/9, 2015 at 13:45 Comment(4)
Did anything else change on your machine? New jvm / jdk? New dependency / jars in your project? Is it just this one project that won't index, or all?Overmodest
Is your project located on a network file system? Did you try another version of IntelliJ? Is there something interesting in the logs ? (likely ~/.IntelliJ/system/log)Tripitaka
@Overmodest Nothing else as far as I'm aware, and as I said in my question, I tried different projects. Like, it was working, I closed IntelliJ, rebooted awhile later, and then when I opened IntelliJ again after the reboot, it started doing this.Milker
@Nebelmann Nope, it is local, on an SSD RAID array that I've benchmarked at 1.2GB/s read. I just tried the IntelliJ IDEA 15 EAP and it is exhibiting this too. The logs don't say much, here is the last bit (the only relevant bit I can find in the last 100 lines): 2015-09-13 10:50:28,495 [ 13439] INFO - indexing.UnindexedFilesUpdater - Indexable files iterated in 5192 ms 2015-09-13 10:50:28,495 [ 13439] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 62583 files to update Milker
M
25

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.

Milker answered 19/9, 2015 at 21:3 Comment(3)
Uh, what.........?Rhinencephalon
I can't believe it, but this actually worked for me.Titillate
unbelievably worked for me as well. This gotta be one of the strangest things I have ever seen (I am not seeing segfaults actually, and my versione is 2023.1.4, but still)Telpherage
Z
92

Try Invalidating the cache and restarting IntelliJ.

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

Zyrian answered 19/7, 2016 at 10:51 Comment(6)
This worked for me but you have to be quick as if you can't get to the menu fast enough it freezes again.Hhour
Cured my IntelliJ IDEA 2020.2Meenen
Invalidating caches and restarting intellij ide solution worked for me.Aestheticism
Worked on 2021.1 alsoTilda
Additionally: There are options available for invalidate cache. Mark only "Clear downloaded shared indexes" was enoughTilda
This usually helps, but it's very tiring having to invalidate caches and reindex massive projects multiple times a week. Not that that's your fault...Sverige
M
25

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.

Milker answered 19/9, 2015 at 21:3 Comment(3)
Uh, what.........?Rhinencephalon
I can't believe it, but this actually worked for me.Titillate
unbelievably worked for me as well. This gotta be one of the strangest things I have ever seen (I am not seeing segfaults actually, and my versione is 2023.1.4, but still)Telpherage
P
23

Edit Intellij[VERSION]/bin/idea.properties, set idea.max.intellisense.filesize=50.

Update: Intellij will skip index files that size larger than 50kb. Try this if you have many libraries or many large files (too many characters one line or too many lines).

Proportionable answered 4/6, 2016 at 6:27 Comment(4)
While your hint might answer the question, it is absolutely not providing any hint on why it might solve the problem. This makes the answer (if at all) less useful to others. So, please consider explaining about about your hint.Alcyone
jetbrains.com/help/idea/…Cati
this fixed it for me as opposed to cache invalidation, restarts and deleting .idea! Note that on Mac I had to "show package contents" of the Application to get to the .properties file.Fosdick
Mine was 2500, I set it to 1000 now my PHPStorm can index php app on WSL2. thanks!Unpleasant
S
20

I had this issue as well with version 2016.2 on Mac OS X. I had to do a force quit to end the application, then I deleted the .idea folder. The next time I launched IntelliJ everything worked fine. It had no problem indexing the project.

Schauer answered 23/8, 2016 at 16:0 Comment(3)
Finally a simple way that TOTALLY works. No idea what is causing it exactly, will try removing files of the .idea folder I backed up later, seeing what file in particular causes this issue.Monopolize
Idea 2020.2 and this problem just occurred. "Invalidate Caches / Restart" did not solve the indexing issue. Removal of .idea directory however did :-)Coycoyle
I can testify that this resolved my issue too, having I searched and tried many answers. Though to caveat this, I had recently upgraded IntelliJ. So, wondering whether the consequent might have been something incompatible with the updated code saved in .ideaErund
T
15

I ran into this problem today on a Mac. It would hang before I was able to get to the menu and invalidate the cache.

I deleted the cache from command line using the following command and it worked for me.

rm -rf ~/Library/Caches/JetBrains/IntelliJIdea*

After that it started up with no issues.

Tibia answered 17/10, 2021 at 0:52 Comment(3)
The only thing that worked for me.Blanks
This worked for me in v2023.1. Thank you.Ratchet
God bless you a good person! The only thing that workedGrand
H
11

I was stuck with a similar issue with the latest IntelliJ Idea 2019.3, so maybe it'll help. For me the issue was with one of the plugins. Uninstalling, reinstalling, and cleaning caches didn't help. My steps were:

  1. Kill Intellij. Start it over.
  2. When it's starting and about to load a project, be quick and cancel opening the project. This way you'll end up with a small window with a list of previously opened projects and a few menu items.
  3. Open menu > plugins, disable them all.
  4. Restart Intellij Idea. Open any project.

If step 4 above succeeds (which happened to me), one by one try enabling the plugins to see which one is causing error. For me it was Kubernetes plugin from JetBrains.

Howdy answered 11/12, 2019 at 14:58 Comment(2)
Mine was stuck if the Laravel plugin was enabled, I had to remove itTableware
I uninstalled the Kubernetes plugin and disabled a few others, and the problem is gone :) Really sad that this is still happening in 2023, almost 4 years later :/Sham
R
7

Select Help -> Debug Log Settings...

Add the following line (note the leading # symbol)

#com.intellij.util.indexing:trace

Relaunch the IDE (don't need to invalidate cache as that will cause it to start from scratch, whereas restarting from the point of failure, for me anyway, reported the problem file as soon as I restarted):

Scheduling indexing of file://C:/dev/tools/ruby/lib/ruby/2.2.0/x64-mingw32/win32ole.so by request of index Stubs

Our project doesn't use win32ole, so I moved the file to a safe location and restarted my IDE. Bingo, the problem was gone, and indexing finally completed after almost 1 year of effectively using Intellij as a slightly-smarter-than-notepad Ruby editor.

Reyreyes answered 9/11, 2017 at 12:57 Comment(0)
A
6

In my case I found out that Intellij is actually trying to index a 50GB directory with logs that was under the project's root. Make sure that if you have such a directory, it is marked as "Excluded" in the IDE.

You can see which file the IDE is indexing currently in the Indexing Status window (access by clicking on the indexing message in the toolbar). You may need to enlarge this window to see the full path of the file currently being indexed.

Aimo answered 1/5, 2018 at 7:54 Comment(1)
This should be the accepted answer, I had exactly this problem...huge logs in a sub directory causing indexing to take forever. Even restarting and clearing cache didn't help here.Outward
L
4

In PhpStorm, what solved this for me was excluding folders I didn't need to be indexed from the indexing (specifically the vendor folder, a caches folder, and a few asset folders that contained thousands of images). Instantly it began making progress and completed.

To do this:

  1. In the project directory list, right click the folder you want to exclude
  2. Mark Directory As Excluded
Lanciform answered 14/6, 2018 at 18:7 Comment(1)
sometimes plugins also scan directories that are not under the project root. in that case, files will have to be excluded using Settings -> File TypesFosdick
G
3

It seems that there might be several reasons for getting into this "indexing" hell. I spent a few hours trying to fix it using the ideas above. At the end of the day, with some profiling work, I found that the bad guy in my case was the CSV plugin: https://plugins.jetbrains.com/plugin/10037-csv-plugin

I had a few (not so large) CSV files serving as input, and although I marked them as not to be indexed, the plugin kept trying to index them. Once I removed the plugin everything worked fine.

Gibbie answered 11/5, 2020 at 6:35 Comment(3)
Great catch. Looks like CSV plugin 2.11.0 breaks indexing. Update is already available.Medor
CSV plugin 2.11.1 fixed itMedor
Not sure which plugin was my culprit but disabling quite a few solved my issueRegress
O
3

Disabling unused plugins will improve the indexing. In my case I have disabled Kotlin plugin from File -> Settings-> Plugins

If you check the Intellij logs, which can be found under C:\Users\<User Name>\.IntelliJIdea2019.1\system\log, you will get a pointer on what is failing. I was getting an error in Kotlin. After disabling the plugin and restarting Intellij, my issue was fixed.

java.lang.RuntimeException: java.io.EOFException
at com.intellij.util.ExceptionUtilRt.rethrow(ExceptionUtilRt.java:31)
at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:120)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.handleError(FSRecords.java:516)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.access$000(FSRecords.java:153)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.writeAndHandleErrors(FSRecords.java:965)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.access$300(FSRecords.java:47)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$AttributeOutputStream.close(FSRecords.java:1629)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:53)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.write(FileAttributeServiceImpl.kt:64)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.writeBooleanAttribute(FileAttributeServiceImpl.kt:48)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClass(IDEKotlinBinaryClassCache.kt:67)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClassHeaderData(IDEKotlinBinaryClassCache.kt:8
Ordure answered 18/11, 2021 at 17:27 Comment(1)
Thanks, for me the Kotlin plugin froze during indexing after upgrading to 2022.1.3Hipster
H
2

I had a similar problem with 2019.1.4. However, mine would change directories and sometimes, eventually, finish. If it did finish, it was somewhere in the 8-10 minute range.

I was all over SO, and even JetBrains' forums. I excluded directories via Project Structure | Modules. I used Invalidate Caches And Restart on multiple occasions. I tried having only 1 project open to let it finish. I installed and tried 2019.2.4 and 2019.3.3 (the latter would crash for other reasons). And best of all, it only seemed to happen on one project!

What ultimately led me to an answer was Help > Activity Monitor... where I found psi.impl.cache.impl.todo was running at nearly 100% CPU and not showing signs of stopping.

It turned out, I had a TODO filter setup with a poorly-defined RegEx. It was something like \b.*wip\b.*; the idea was to find all of our "WIP" values. Well, the leading .* was a huge mistake and one that didn't occur to me until losing many hours blaming a plugin upgrade. I believe the reason this was a bad filter was because the project it was hanging on is in ExtJS, which is JavaScript, which means things are in triplicate with the app.js file and whatnot...

Update In IntelliJ 2020.x and 2021.x, the option has moved to Help > Diagnostic Tools > Activity Monitor.

Henry answered 2/3, 2020 at 16:23 Comment(1)
In IDEA 2021.1 the activity monitor is reachable via Help > Diagnostic Tools > Activity Monitor.Wain
L
1

Had the same issue in the past on some Scala project. I have installed IDEA 16 EAP (https://confluence.jetbrains.com/display/IDEADEV/IDEA+16+EAP) and the problem has gone.

Lynellelynett answered 10/2, 2016 at 10:26 Comment(0)
P
1

I was also facing the freezing issue with Intellij 2021.3. Earlier I was using Intellij 2021.1 version and that was working fine, but since I upgraded to Intellij version to 2021.3, it started freezing on indexing of files.

Someone in this thread suggested to repair the IDE using the Repair IDE feature. Butm that didn't work for me.

So, I went through the thread dumps available in the Intellij logs folder. After analyzing the logs, I found out that calls are blocking on the Package Search plugin. So, I disabled that plugin in Settings -> Plugin. To do that I had to pause indexing at the start for the time being. After disabling this plugin, it is working fine for me.

This is a known issue and I know disabling it is not a correct fix for it. But I will use it till Intellij will release an official fix for this issue.

Psalmbook answered 16/12, 2021 at 12:55 Comment(0)
C
0

I had the same problem with IntelliJ 2017.3.2. When I clicked on the indexing progress bar I noticed it was hung on a directory within my build directory. When I did a gradlew clean, which removed that directory, then the indexing was able to proceed.

Cowcatcher answered 2/1, 2018 at 23:56 Comment(0)
I
0

I have encountered this problem, and resolved it:

  1. Remove Idea.
  2. Delete all files and directories which match the regular expression *jetbrain* and *IntelliJ* in my computer, a Mac mini.
  3. Then install Idea.

I also tried to just delete the Idea cache files. It do not work.

Inclose answered 9/1, 2018 at 11:31 Comment(0)
M
0

There might be another project opened in parallel in a new window which is being indexed.

Monotheism answered 11/8, 2021 at 5:48 Comment(0)
F
0

I was using the Elm plugin and installed the elm-bounded-nats package which included a semi-large source file. IntelliJ kept hanging on this file, but did not always report this correctly in the indexing popover dialog (perhaps due to threading). When I exluded this specific file in Settings -> File Types ("Nats.elm"), indexing managed to complete successfully. Now the editor renders errors for this package, but the compilation process still works.

Fosdick answered 17/9, 2021 at 7:25 Comment(0)
F
0

Invalidate Cache and Restart did not work for me on IntelliJ 2021.3 Ultimate. I was curious to see if the new Repair IDE feature on 2021.3 Ultimate version works on this issue on my mac.

  1. On startup, IntelliJ froze on indexing
    • Force quit and relaunched IntelliJ
  2. On Startup, manually "paused" the indexing from the status bar at the bottom
  3. Invalidated cache and restarted
    • Still froze on indexing
    • Forced quit and relaunched IntelliJ
  4. Repeated Step #2 on startup
  5. From File Menu, executed Repair IDE, and went through repair steps
    • FIXED; no longer froze on indexing
  6. Quit IntelliJ and Relaunch
    • No Index issues
Fineness answered 15/12, 2021 at 18:7 Comment(0)
K
0

It looks like the problem can come from many different sources as other answers point out.

In my case, it was the Subversion plugin that had difficulties communicating with the server and made the IDE hang on indexing.

Kersten answered 25/5, 2022 at 11:58 Comment(0)
A
0

I have tried setting idea.max.intellisense.filesize, clearing cache and many other ways, and they didn't work.

For me, below steps solved (or at least, mitigated) the problem:

  1. Make sure your antivirus software excludes idea64.exe (or similar). Even try to disable real-time scan.
  2. Disable all plugins and restart the IDE. If it runs smoothly, try to enable one by one to detect the culprit. Mine were "DGS" and "GraphQL".
Ausgleich answered 3/7, 2023 at 8:9 Comment(0)
S
0

I tried all advices here but it has stuck right after opening the project. So I forcestopped it through task manager , removed project's .idea folder and then relaunched, it restored the .idea one , started indexing but this time I was able to mark as excluded vendor, bootstrap, storage/views folders and now it opens the project quickly as before

Sextan answered 2/10, 2023 at 19:28 Comment(0)
I
0

In my case i had to disable the sonar plugin.

Indigestive answered 5/12, 2023 at 11:57 Comment(0)
C
0

I fixed this by running the update through Jetbrains Toolbox software.

The top answers answers weren't working so I followed an IntelliJ forum recommendation to download Toolbox. From there the update from 2021.0.1 to 2023.3.2 went without a hitch. You can uninstall it after if you don't want another software manager on your machine

Cicatrix answered 19/1, 2024 at 23:43 Comment(0)
T
0

If you have a WebStorm (for example, version 2023.1), and it stuck on "Loading indexes" you can just "File -> Close project", then delete project from recent projects and again "Open" it. It worked for me.

As a workaround, you could:

  1. try invalidating the caches (File > Invalidate caches, Invalidate and Restart)
  2. For projects not using the build tools, add the <sourceFolder url="file://$MODULE_DIR$/some_folder" isTestSource="false" /> manually like the below image.
  3. For Maven project, use this way: https://stackoverflow.com/a/270490/ and reload the project.
  4. For Gradle project, use Add another java source directory to gradle script and reload the project

enter image description here

Thalassa answered 23/5, 2024 at 3:5 Comment(0)
P
0

I don't know the internals but cleaning module cache help significantly reduce the indexing time

go clean -modcache
Portraiture answered 17/7, 2024 at 6:9 Comment(0)
F
-2

I was able to resolve this problem by removing all of my "target" folders from my project.

Falsify answered 7/2, 2019 at 7:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.