ERROR - j.psi.stubs.StubTreeLoaderImpl - Outdated stub in index

Answered

PimplePhpTypeProvider4 in method getType crash with error (ERROR - j.psi.stubs.StubTreeLoaderImpl - Outdated stub in index)


public @Nullable PhpType getType(PsiElement psiElement) {

String signature = getTypeForArrayAccess(psiElement);
if (signature == null) {
signature = getTypeForParameterOfAnonymousFunction(psiElement);
}
if (signature == null) {
return null;
}
Project project = psiElement.getProject();
if (DumbService.isDumb(project) && DumbService.getInstance(project).isAlternativeResolveEnabled()) {
return null;
}

Collection<? extends PhpNamedElement> col;
try {
col = getBySignature(signature, null, 0, project);
} catch (Exception e) {
return null;
}

// Return first element
for (PhpNamedElement elem : col) {
return elem.getType();
}

return null;
}
6 comments
Comment actions Permalink
2020-05-17 13:20:18,174 [ 174155] ERROR - j.psi.stubs.StubTreeLoaderImpl - Outdated stub in index: file:/OMSAppModule.php indexed at 1589624094000 with document byte size = 8222, char size = 8222, doc=DocumentImpl[file://D:/OMS/dev/OMS/Modules/OMSAppModule/OMSAppModule.php], docSaved=false, wasIndexedAlready=true, queried at 1589624094000
doc length=8287
file length=8222
cached PSI class com.jetbrains.php.lang.psi.PhpFileImpl
PSI length=8287
projects with file: 1
java.lang.Exception
at com.intellij.psi.stubs.StubTreeLoaderImpl.diagnoseLengthMismatch(StubTreeLoaderImpl.java:175)
at com.intellij.psi.stubs.StubTreeLoaderImpl.checkLengthMatch(StubTreeLoaderImpl.java:146)
at com.intellij.psi.stubs.StubTreeLoaderImpl.readFromVFile(StubTreeLoaderImpl.java:111)
at com.intellij.psi.stubs.StubTreeLoader.stubTreeAndIndexDoNotMatch(StubTreeLoader.java:58)
at com.intellij.psi.stubs.StubProcessingHelperBase.inconsistencyDetected(StubProcessingHelperBase.java:158)
at com.intellij.psi.stubs.StubProcessingHelperBase.checkType(StubProcessingHelperBase.java:100)
at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:79)
at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:419)
at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:107)
at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:95)
at com.jetbrains.php.PhpIndexImpl.getByName(PhpIndexImpl.java:827)
at com.jetbrains.php.PhpIndexImpl.getByFQN(PhpIndexImpl.java:802)
at com.jetbrains.php.PhpIndexImpl.getClassesByFQNInternal(PhpIndexImpl.java:877)
at com.jetbrains.php.PhpIndexImpl.getAnyByFQN(PhpIndexImpl.java:914)
at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:591)
at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:142)
at com.jetbrains.php.PhpIndexImpl.getClasses(PhpIndexImpl.java:708)
at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:617)
at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:575)
at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:496)
at com.jetbrains.php.lang.psi.resolve.types.PhpTypeFromSuperMemberTP.getBySignature(PhpTypeFromSuperMemberTP.java:50)
at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:644)
at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:508)
at sk.sorien.pimpleplugin.pimple.Utils.findPimpleContainer(Utils.java:230)
at sk.sorien.pimpleplugin.pimple.Utils.findPimpleContainer(Utils.java:217)
at sk.sorien.pimpleplugin.pimple.PimplePhpTypeProvider4.getBySignature(PimplePhpTypeProvider4.java:79)
at sk.sorien.pimpleplugin.pimple.PimplePhpTypeProvider4.getType(PimplePhpTypeProvider4.java:48)
2020-05-17 13:20:18,306 [ 174287] ERROR - j.psi.stubs.StubTreeLoaderImpl - PhpStorm 2020.1.1 Build #PS-201.7223.96
2020-05-17 13:20:18,307 [ 174288] ERROR - j.psi.stubs.StubTreeLoaderImpl - JDK: 1.8.0_201; VM: Java HotSpot(TM) 64-Bit Server VM; Vendor: Oracle Corporation
2020-05-17 13:20:18,308 [ 174289] ERROR - j.psi.stubs.StubTreeLoaderImpl - OS: Windows 10
2020-05-17 13:20:18,309 [ 174290] ERROR - j.psi.stubs.StubTreeLoaderImpl - Last Action: ShowIntentionActions
0
Comment actions Permalink

I'm sorry, but your question is unclear. 

0
Comment actions Permalink

What is not clear here? Complete crash of IDE when executing the call to

PimplePhpTypeProvider4.getBySignature
0
Comment actions Permalink

Is the community still working? Or are developers somewhere else?

0
Comment actions Permalink

In the first post, you have provided an implementation that calls getBySignature which doesn't come from PhpIndexImpl.java class - there are just following two available:

com.jetbrains.php.PhpIndexImpl#getBySignature(java.lang.String)
com.jetbrains.php.PhpIndexImpl#getBySignature(java.lang.String, java.util.Set<java.lang.String>, int)

In between calling getBySignature provided by the PHP plugin's implementation class and your one, there is still some Utils class which always can be the reason for the failure.

Can you provide a minimal example which will let to reproduce such an issue?

1
Comment actions Permalink

Yes, the problem was precisely because of the method getBySignature call located here in PhpTypeProvider4.

Here is a solution to the problem that I "spied" in another plugin.

@Override
public @Nullable PhpType getType(PsiElement psiElement) {
Project project = psiElement.getProject();

if (!ProjectComponent.isEnabled(project)) {
return null;
}

if (DumbService.getInstance(project).isDumb() || NoAccessDuringPsiEvents.isInsideEventProcessing()) {
return null;
}

String signature = getTypeForArrayAccess(psiElement);
if (signature == null) {
signature = getTypeForParameterOfAnonymousFunction(psiElement);
if (signature == null) {
return null;
}
}

return new PhpType().add("#" + this.getKey() + signature);
}
0

Please sign in to leave a comment.