问题
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.
回答1:
Try Invalidating the cache and restarting IntelliJ.
In the File menu, select Invalidate Caches / Restart... and then click the Invalidate and Restart button.
回答2:
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.
回答3:
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)
回答4:
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.
回答5:
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, problem gone, indexing finally completed after almost 1 year of effectively using intellij as a slightly-smarter-than-notepad ruby editor.
回答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.
回答7:
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.
回答8:
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:
- in the project directory list, right click the folder you want to exclude
- Mark Directory As
- Excluded
回答9:
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, cleaning caches didn't help. My steps were:
- Kill intellij, start it over
- 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.
- Open menu > plugins, disable them all
- 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.
回答10:
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.
回答11:
I have encountered this problem, and resolved it:
- remove idea
- delete all files and dirs which name regex 'jetbrain' and 'IntelliJ' in my computer(Mac mini)
- then install idea
I also try just delete idea cache files, it do not work.
回答12:
I was able to resolve this problem by removing all of my "target" folders from my project.
来源:https://stackoverflow.com/questions/32550292/why-is-intellij-idea-hanging-on-indexing