laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
176 stars 7 forks source link

[Bug]: Outdated stub error #453

Open olivernybroe opened 2 years ago

olivernybroe commented 2 years ago

Bug description

Didn't see anything breaking, it happened because I updated the project from github while it was indexing

Plugin version

4.4.4.213

Operating system

MacOS

Steps to reproduce

No response

Relevant log output

Outdated stub in index: file:///Users/olivernybroe/Code/worksome-platform/app/Services/Intercom/Intercom.php indexing timestamp = 1637761090736, binary = false, byte size = 19291, char size = 19291, doc=DocumentImpl[file:///Users/olivernybroe/Code/worksome-platform/app/Services/Intercom/Intercom.php], docSaved=true, wasIndexedAlready=true, queried at 1637761090736
doc length=19161
file length=19161
cached PSI class com.jetbrains.php.lang.psi.PhpFileImpl
projects with file: 1
physical file exists; length = 19161

java.lang.Exception
    at com.intellij.psi.stubs.StubTreeLoaderImpl.diagnoseLengthMismatch(StubTreeLoaderImpl.java:181)
    at com.intellij.psi.stubs.StubTreeLoaderImpl.checkLengthMatch(StubTreeLoaderImpl.java:147)
    at com.intellij.psi.stubs.StubTreeLoaderImpl.readFromVFile(StubTreeLoaderImpl.java:114)
    at com.intellij.psi.stubs.StubTreeLoader.lambda$stubTreeAndIndexDoNotMatch$0(StubTreeLoader.java:67)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:237)
    at com.intellij.psi.stubs.StubTreeLoader.stubTreeAndIndexDoNotMatch(StubTreeLoader.java:65)
    at com.intellij.psi.impl.source.FileTrees.reconcilePsi(FileTrees.java:193)
    at com.intellij.psi.impl.source.FileTrees.withAst(FileTrees.java:141)
    at com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement(PsiFileImpl.java:215)
    at com.intellij.psi.impl.source.PsiFileImpl.calcTreeElement(PsiFileImpl.java:734)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getNode(StubBasedPsiElementBase.java:128)
    at com.intellij.extapi.psi.ASTDelegatePsiElement.findChildByType(ASTDelegatePsiElement.java:183)
    at com.jetbrains.php.lang.psi.elements.impl.ParameterImpl.getDefaultValue(ParameterImpl.java:438)
    at com.laravel_idea.plugin.helperCodeGeneration.d.c.b(c.java:50)
    at com.laravel_idea.plugin.helperCodeGeneration.d.f$a.a(f$a.java:14)
    at com.laravel_idea.plugin.helperCodeGeneration.d.f$a.invoke(f$a.java:14)
    at kotlin.text.StringsKt__AppendableKt.appendElement(Appendable.kt:85)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:3344)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:3361)
    at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:3360)
    at com.laravel_idea.plugin.helperCodeGeneration.d.f.e(f.java:14)
    at com.laravel_idea.plugin.helperCodeGeneration.d.h.b(h.java:25)
    at com.laravel_idea.plugin.helperCodeGeneration.d.b.d(b.java:21)
    at com.laravel_idea.plugin.helperCodeGeneration.d.a.b(a.java:31)
    at com.laravel_idea.plugin.helperCodeGeneration.c.a.a(a.java:66)
    at com.laravel_idea.plugin.helperCodeGeneration.f.a(f.java:92)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:521)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:486)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1084)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:78)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:161)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:118)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:115)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:78)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:486)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:407)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:246)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:32)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:225)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:217)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
adelf commented 2 years ago

This auto-generation for helper code will be a nightmare. I'm also going to implement it for Eloquent models... not a good idea)

olivernybroe commented 2 years ago

Haha, I feel your pain. I added it to pest plugin and have had so many bugs reported because of it 😭

Still have new issues coming up once in a while...

I hope they soon add a better solution for it 👀

dmason30 commented 2 years ago

@olivernybroe I am getting this now too :( Invalidate & Restart the only solution for now?

olivernybroe commented 2 years ago

@dmason30 yep. That solves it and it doesn't appear that often, at least for me.

Next time it happens, please share your stacktrace, it might happen in a different location in the code for you 👍