Why do I have to invalidate my cache fairly often?

PhpStorm 2017.2.4
Build #PS-172.4155.41, built on September 15, 2017
JRE: 1.8.0_152-release-915-b11 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

 

It was probably about 3 months ago I had an issue where my "Navigate to File" function was not showing any results. I found a forum topic that said to invalidate my cache and restart. Voila, it worked. Although, ever since then I've been having to do this fairly regularly. Sometimes as much as 3 times a week.

Is there a reason the cache becomes corrupt and I need to invalidate it frequently? How/Can I stop this from being a weekly routine?

 

 

 

25 comments
Comment actions Permalink

Hi there,

TBH -- no idea. But it might be related to one of the plugins that you are using (custom one, not bundled by default). At very least I remember seeing something like this in one of the the Issue Tracker tickets.

Therefore:

1) Check your idea.log for possible hints/exceptions (you may empty so it has only most recent info) -- "Help | Show Log in XXX"

2) Try with all custom (not bundled by default) plugins disabled (at very least for a day or so). If you cannot disable ALL of them .. then try leaving only 1-2 that you desperately need -- at very least it should narrow the scope (if the issue is in plugin, of course)

0
Avatar
Vladimir Luchansky
Comment actions Permalink

Hello,

Do you work with files located remotely over mapped share or some other way by any chance?

0
Comment actions Permalink

What's funny is that I wrote this comment out of frustration, and then haven't had the problem since. I'm hopeful the problem was OS related and has been magically fixed with some update there.

 

@Vladimir, the files are local

@Andriy, thank you. I like log files and had no idea these existed. next time it happens I'll be looking here first.

0
Comment actions Permalink

I have the same problem... I have to clear the cache very often. After reading these posts, i have figured out, that the File Search does not work after restarting PhpStorm.

Maybe it is related to the indexing process during the shutdown, because this is the only error i get in the log file:

2017-11-29 16:58:10,728 [24236719]   INFO - il.indexing.FileBasedIndexImpl - START INDEX SHUTDOWN 
2017-11-29 16:58:10,750 [24236741]  ERROR - il.indexing.FileBasedIndexImpl - Problems during index shutdown
java.lang.NullPointerException
    at com.intellij.util.indexing.impl.ValueContainerImpl.saveTo(ValueContainerImpl.java:427)
    at com.intellij.util.indexing.impl.ChangeTrackingValueContainer.saveTo(ChangeTrackingValueContainer.java:180)
    at com.intellij.util.indexing.impl.ValueContainerMap$1.append(ValueContainerMap.java:59)
    at com.intellij.util.io.PersistentHashMap.doAppendData(PersistentHashMap.java:465)
    at com.intellij.util.io.PersistentHashMap.appendData(PersistentHashMap.java:443)
    at com.intellij.util.indexing.impl.ValueContainerMap.doPut(ValueContainerMap.java:56)
    at com.intellij.util.indexing.impl.ValueContainerMap.doPut(ValueContainerMap.java:29)
    at com.intellij.util.io.PersistentHashMap.put(PersistentHashMap.java:362)
    at com.intellij.util.indexing.impl.MapIndexStorage$3.onDropFromCache(MapIndexStorage.java:126)
    at com.intellij.util.indexing.impl.MapIndexStorage$3.onDropFromCache(MapIndexStorage.java:93)
    at com.intellij.util.containers.SLRUMap.clear(SLRUMap.java:146)
    at com.intellij.util.indexing.impl.MapIndexStorage.flush(MapIndexStorage.java:150)
    at com.intellij.util.indexing.VfsAwareMapIndexStorage.flush(VfsAwareMapIndexStorage.java:107)
    at com.intellij.util.indexing.impl.MapIndexStorage.close(MapIndexStorage.java:162)
    at com.intellij.util.indexing.VfsAwareMapIndexStorage.close(VfsAwareMapIndexStorage.java:119)
    at com.intellij.util.indexing.MemoryIndexStorage.close(MemoryIndexStorage.java:117)
    at com.intellij.util.indexing.impl.MapReduceIndex.doDispose(MapReduceIndex.java:172)
    at com.intellij.util.indexing.VfsAwareMapReduceIndex.doDispose(VfsAwareMapReduceIndex.java:202)
    at com.intellij.util.indexing.impl.MapReduceIndex.dispose(MapReduceIndex.java:159)
    at com.intellij.util.indexing.FileBasedIndexImpl.e(FileBasedIndexImpl.java:518)
    at com.intellij.util.indexing.FileBasedIndexImpl.dispose(FileBasedIndexImpl.java:482)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:138)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:107)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:151)
    at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:107)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:126)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:107)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:151)
    at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:107)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:137)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:121)
    at com.intellij.openapi.application.impl.ApplicationImpl.j(ApplicationImpl.java:274)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1030)
    at com.intellij.openapi.application.impl.ApplicationImpl.b(ApplicationImpl.java:274)
    at com.intellij.openapi.application.impl.ApplicationImpl.a(ApplicationImpl.java:808)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:784)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:773)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:750)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:745)
    at com.intellij.ide.actions.ExitAction.perform(ExitAction.java:35)
    at com.intellij.ide.actions.ExitAction.actionPerformed(ExitAction.java:31)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:216)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:233)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.a(ActionMenuItem.java:310)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:911)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:300)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.a(ActionMenuItem.java:117)
    at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:86)
    at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:109)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:118)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:117)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:513)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
    at java.awt.Component.processMouseEvent(Component.java:6541)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6306)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4897)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4719)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4719)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:821)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:645)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - PhpStorm 2017.2.4  Build #PS-172.4155.41
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - JDK: 1.8.0_152-release
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - VM: OpenJDK 64-Bit Server VM
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - Vendor: JetBrains s.r.o
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - OS: Linux
2017-11-29 16:58:10,752 [24236743]  ERROR - il.indexing.FileBasedIndexImpl - Last Action: Exit
2017-11-29 16:58:10,752 [24236743]   INFO - il.indexing.FileBasedIndexImpl - END INDEX SHUTDOWN

How can i prevent restarting PhpStrom by 'Invalidate caches'?

Thanks in advance.

0
Comment actions Permalink

@Falko Matthies

Please provide whole log (as a text file to download -- do not post actual content here).

So far it could be:

  • bad plugin
  • HDD/RAM issues
0
Comment actions Permalink

I have uploaded the file to ftp://ftp.intellij.net/.uploads/ The name is 115000667144-idea.log

0
Comment actions Permalink

@Falko Matthies

Thanks.

Lets hope JetBrains support team will notice it soon. If not -- ping here again.

P.S. I do not work for JetBrains so cannot help you on this as I simply cannot see uploaded into that location files.

 

0
Comment actions Permalink

@Andriy Bazanov

Thanks for your fast reply. I have uploaded the content to https://pastebin.com/wfhQg3Lz.

Todays start produced also two errors:

2017-11-30 08:09:01,710 [  10848]   INFO - il.indexing.FileBasedIndexImpl - Rebuild requested for index Trigram.Index
com.intellij.util.indexing.StorageException: com.intellij.util.indexing.StorageException: com.intellij.util.io.PersistentEnumeratorBase$CorruptedException: PersistentEnumerator storage corrupted /home/falko/.PhpStorm2017.2/system/index/.persistent/trigram.index/values.values
2017-11-30 08:09:01,760 [  10898]   INFO - il.indexing.FileBasedIndexImpl - Rebuild requested for index IdIndex
com.intellij.util.indexing.StorageException: com.intellij.util.indexing.StorageException: com.intellij.util.io.PersistentEnumeratorBase$CorruptedException: PersistentEnumerator storage corrupted /home/falko/.PhpStorm2017.2/system/index/.persistent/idindex/values.values

 

0
Comment actions Permalink

Please disable ALL custom (not bundled by default) plugins, Invalidate caches (File | Invalidate Caches) and restart IDE -- see how it will behave this time.

You do have .ignore plugin installed. The previous 2.3.0 version was the main reason for such behaviour. The latest 2.3.2 (which you have) should have it fixed (and by reports from other users -- it works OK for them now).

How often did you you need to do invalidating caches till now? Lets see how it will behave will all plugins disabled.

If it will work OK for few hours -- you may re-enable some plugins (I guess "PHP Annotations" and "Symfony plugin" are the most important for you). Enable the most critical first and see how it will behave again. If all good -- enable the rest -- maybe the issue will disappear completely this time.

P.S. 2017.3 was released yesterday. Try upgrading -- it does better in this particular regard (no such issues reported so far AFAIK).

0
Comment actions Permalink

@Andriy Bazanov

I have disabled all the custom plugins step by step. As you said, after disabling the ignore plugin, the indexing worked fine and i did not need to invalidate the cache anymore. The curious thing, after enabling only the ignore plugin the ide keeps working correctly. I have reenabled the plugins (also step by step) and everything works fine.

Later i have updated PhpStorm to 2017.3 (and also some plugins were updated) and everything works still correctly. There are some (new) errors in the log file, some regards to the symfony plugin, some to other plugins but i dont have the problem to invalidate the cache anymore. I have observed the behavior and the logs about one week and it looks good.

Thank you!

0
Comment actions Permalink

Looks like this is still happening in more recent versions.  Turning off the .ignore plugin seems to have solved the problem for me too.

0
Comment actions Permalink

This is happening crazy often lately for me and my collegues. We basically lost tons of time because "find references" would find only a part of them and we would later discover there are more. Will check the .ignore plugin angle for starters.

0
Comment actions Permalink

Nejc, I would suggest contacting us directly: there might various reason for this, starting from a project location and ending with 3rd party plugins.

 

0
Comment actions Permalink

For the record, I had to turn off both the .ignore plugin and the AWS CloudFormation plugin.  Once I got rid of both of those, everything went back to working fine.

0
Comment actions Permalink

I'm on 2018.2.5 and this happens to me almost every time when I add new project into gradle build and refresh gradle. Or when I install artifact into local maven repo, so in that case IntelliJ has to switch reference to such lib from remote repo into local repo. Switching itself works fine, but some other classes are not compiling.....

 

I did not find any hints/exceptions in log.

0
Comment actions Permalink

Maciej, please submit your logs within a support ticket, the IntelliJ guys will take a look:

https://intellij-support.jetbrains.com/hc/en-us

0
Comment actions Permalink

Should I create new ticket, or attach to this one?

0
Comment actions Permalink

Please use the Submit a Request button, it'll create a personal ticket and not a forum thread.

0
Comment actions Permalink

This link/request below is related to this question. Please let the Idea folks know this is important. There's really no excuse for this kind of problem to drag on. It feels like we loose hours and days of build failure troubleshooting because of it. Thanks.

https://youtrack.jetbrains.com/issue/IDEA-203100

1
Comment actions Permalink

this happens to me every few project switches and as I work on several small related microservices, I need to switch projects a lot. I lose about 30-45 minutes a day waiting for index rebuilds after invalidating...

I only have official flutter, protobuf and markdown plugins installed on top of android studio.

It's annoying enough that I'm forced by google to use this software and now it's also so unreliable...

0
Comment actions Permalink

I'm now on 2021.2.3  Intellij/Webstorm/PyCharm and do not have to invalidate cache almost at all. At least for me the situation has improved.

1
Comment actions Permalink

Thanks for the update!

 

0
Comment actions Permalink

so could we please get info in which version the fixes to this problem were introduced? it would be very useful in case of Android Studio to know if it is sufficient to switch to beta (based on 2021.1.1) or if it's necessary to go for canary (2021.2.1) or if neither of these will help (in case fixes were introduced in 2021.2.3).

Thanks!

0
Comment actions Permalink

This thread is back from 2017. In mid-2021 another related issue was reported: https://youtrack.jetbrains.com/issue/IDEA-275337. Majority of recent complaints were caused by it.

The problem was fixed recently & the fix should be included in IntelliJ IDEA-based IDEs version 2021.2.3. 

Unfortunately I can't say what Android Studio version has this fix included & if it suffers from this problem at all. But I would still suggest to install the most recent beta build of it & check if the problem happens there.

1
Comment actions Permalink

for anyone coming here from Android Studio stable release (based on idea 2020.3.1 as of 2021/11) :

for me in 95% of cases this problem seem to affect only classes from my own project and I've noticed that instead of "invalidate caches / restart" which takes 1-5 minutes, issuing from a terminal in a project's root folder

 find . -name '*.java' |xargs touch

solves the issue 95% of times. This method takes only about 10-15 seconds, including opening terminal and typing :)

0

Please sign in to leave a comment.