wt-io-it / odoo-pycharm-plugin

Plugin to Support Odoo in Pycharm
GNU Affero General Public License v3.0
19 stars 10 forks source link

Error during indexing #5

Closed SimoRubi closed 2 years ago

SimoRubi commented 2 years ago

Hi, I have the plugin https://plugins.jetbrains.com/plugin/13083-odoo-autocompletion-support installed in PyCharm and it has raised the following error during the indexing process, here the stack trace:

Stack trace Error while indexing /path/to/odoo/odoo/addons/test_new_api/tests/test_new_fields.py To reindex this file IDEA has to be restarted java.lang.AssertionError: Reentrant indexing at com.intellij.util.indexing.FileBasedIndexImpl.markFileIndexed(FileBasedIndexImpl.java:1635) at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1546) at com.intellij.util.indexing.FileBasedIndexImpl.scheduleFileForIndexing(FileBasedIndexImpl.java:1793) at com.intellij.util.indexing.events.ChangedFilesCollector.lambda$processFilesToUpdateInReadAction$4(ChangedFilesCollector.java:235) at com.intellij.util.indexing.events.ChangedFilesCollector.lambda$processFilesInReadAction$5(ChangedFilesCollector.java:259) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:222) 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.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:221) at com.intellij.util.indexing.events.ChangedFilesCollector.lambda$processFilesInReadAction$6(ChangedFilesCollector.java:258) at com.intellij.util.ConcurrencyUtil.withLock(ConcurrencyUtil.java:234) at com.intellij.util.indexing.events.ChangedFilesCollector.lambda$processFilesInReadAction$7(ChangedFilesCollector.java:256) at com.intellij.util.indexing.events.VfsEventsMerger.processChanges(VfsEventsMerger.java:93) at com.intellij.util.indexing.events.ChangedFilesCollector.processFilesInReadAction(ChangedFilesCollector.java:255) at com.intellij.util.indexing.events.ChangedFilesCollector.processFilesToUpdateInReadAction(ChangedFilesCollector.java:231) at com.intellij.util.indexing.events.ChangedFilesCollector.ensureUpToDate(ChangedFilesCollector.java:192) at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:785) at com.intellij.util.indexing.FileBasedIndexEx.processExceptions(FileBasedIndexEx.java:244) at com.intellij.util.indexing.FileBasedIndexEx.processValueIterator(FileBasedIndexEx.java:349) at com.intellij.util.indexing.FileBasedIndexEx.processValuesInScope(FileBasedIndexEx.java:318) at com.intellij.util.indexing.FileBasedIndexEx.getValues(FileBasedIndexEx.java:111) at at.wtioit.intellij.plugins.odoo.modules.impl.OdooModuleServiceImpl.lambda$getModule$0(OdooModuleServiceImpl.java:57) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:852) at at.wtioit.intellij.plugins.odoo.modules.impl.OdooModuleServiceImpl.getModule(OdooModuleServiceImpl.java:54) at at.wtioit.intellij.plugins.odoo.pycharm.PyCharmOdooAddonsImportResolver.resolveImportReference(PyCharmOdooAddonsImportResolver.java:36) at at.wtioit.intellij.plugins.odoo.pycharm.PyCharmOdooAddonsImportResolver.resolveImportReference(PyCharmOdooAddonsImportResolver.java:42) at com.jetbrains.python.psi.resolve.PyResolveImportUtil$foreignResults$1.invoke(PyResolveImportUtil.kt:199) at com.jetbrains.python.psi.resolve.PyResolveImportUtil$foreignResults$1.invoke(PyResolveImportUtil.kt) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170) at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194) at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786) at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816) at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807) at com.jetbrains.python.psi.resolve.PyResolveImportUtil.foreignResults(PyResolveImportUtil.kt:201) at com.jetbrains.python.psi.resolve.PyResolveImportUtil.resolveQualifiedName(PyResolveImportUtil.kt:74) at com.jetbrains.python.pyi.PyiUtil.getPythonStubFile(PyiUtil.java:160) at com.jetbrains.python.pyi.PyiUtil.getPythonStub(PyiUtil.java:59) at com.jetbrains.python.pyi.PyiTypeProvider.getReferenceType(PyiTypeProvider.java:74) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getReferenceTypeFromProviders(PyReferenceExpressionImpl.java:530) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getGenericTypeFromTarget(PyReferenceExpressionImpl.java:427) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeFromTarget(PyReferenceExpressionImpl.java:399) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeFromTargets(PyReferenceExpressionImpl.java:310) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getType(PyReferenceExpressionImpl.java:229) at com.jetbrains.python.psi.types.TypeEvalContext.lambda$getType$0(TypeEvalContext.java:176) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114) at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44) at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68) at com.jetbrains.python.psi.types.TypeEvalContext.getType(TypeEvalContext.java:165) at com.jetbrains.python.psi.impl.references.PyQualifiedReference.resolveInner(PyQualifiedReference.java:79) at com.jetbrains.python.psi.impl.references.PyReferenceImpl.multiResolveInner(PyReferenceImpl.java:107) at com.jetbrains.python.psi.impl.references.PyReferenceImpl$CachingResolver.resolve(PyReferenceImpl.java:776) at com.jetbrains.python.psi.impl.references.PyReferenceImpl$CachingResolver.resolve(PyReferenceImpl.java:771) at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolve$1(ResolveCache.java:154) at com.intellij.openapi.util.Computable.get(Computable.java:18) at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:260) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114) at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44) at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68) at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:237) at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:154) at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:169) at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:162) at com.jetbrains.python.psi.impl.references.PyReferenceImpl.multiResolve(PyReferenceImpl.java:94) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.multiFollowAssignmentsChain(PyReferenceExpressionImpl.java:153) at com.jetbrains.python.psi.PyReferenceExpression.multiFollowAssignmentsChain(PyReferenceExpression.java:53) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.followAssignmentsChain(PyReferenceExpressionImpl.java:123) at at.wtioit.intellij.plugins.odoo.models.OdooModelUtil.getStringValueForValueChild(OdooModelUtil.java:74) at at.wtioit.intellij.plugins.odoo.models.OdooModelUtil.detectName(OdooModelUtil.java:42) at at.wtioit.intellij.plugins.odoo.models.OdooModelUtil.detectName(OdooModelUtil.java:28) at at.wtioit.intellij.plugins.odoo.models.index.OdooModelDefinition.(OdooModelDefinition.java:17) at at.wtioit.intellij.plugins.odoo.models.index.OdooModelFileIndex$OdooModelFileIndexer.lambda$mapWatched$0(OdooModelFileIndex.java:113) at at.wtioit.intellij.plugins.odoo.PsiElementsUtil.walkTree(PsiElementsUtil.java:50) at at.wtioit.intellij.plugins.odoo.PsiElementsUtil.walkTree(PsiElementsUtil.java:51) at at.wtioit.intellij.plugins.odoo.PsiElementsUtil.walkTree(PsiElementsUtil.java:51) at at.wtioit.intellij.plugins.odoo.PsiElementsUtil.walkTree(PsiElementsUtil.java:51) at at.wtioit.intellij.plugins.odoo.PsiElementsUtil.walkTree(PsiElementsUtil.java:51) at at.wtioit.intellij.plugins.odoo.models.index.OdooModelFileIndex$OdooModelFileIndexer.mapWatched(OdooModelFileIndex.java:110) at at.wtioit.intellij.plugins.odoo.index.OdooDataIndexer.lambda$map$0(OdooDataIndexer.java:13) at at.wtioit.intellij.plugins.odoo.index.IndexWatcher.runIndexJob(IndexWatcher.java:14) at at.wtioit.intellij.plugins.odoo.index.OdooDataIndexer.map(OdooDataIndexer.java:13) at at.wtioit.intellij.plugins.odoo.index.OdooDataIndexer.map(OdooDataIndexer.java:9) at com.intellij.util.indexing.impl.MapReduceIndex.mapByIndexer(MapReduceIndex.java:306) at com.intellij.util.indexing.impl.MapReduceIndex.mapInput(MapReduceIndex.java:297) at com.intellij.util.indexing.impl.storage.VfsAwareMapReduceIndex.mapInput(VfsAwareMapReduceIndex.java:182) at com.intellij.util.indexing.impl.storage.VfsAwareMapReduceIndex.mapInput(VfsAwareMapReduceIndex.java:47) at com.intellij.util.indexing.impl.MapReduceIndex.mapInputAndPrepareUpdate(MapReduceIndex.java:244) at com.intellij.indexing.composite.CompositeInvertedIndexBase.updateBaseIndex(CompositeInvertedIndexBase.java:240) at com.intellij.indexing.composite.CompositeInvertedIndexBase.mapInputAndPrepareUpdate(CompositeInvertedIndexBase.java:60) at com.intellij.indexing.composite.CompositeInvertedIndexBase.mapInputAndPrepareUpdate(CompositeInvertedIndexBase.java:27) at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1551) at com.intellij.util.indexing.FileBasedIndexImpl.lambda$doIndexFileContent$27(FileBasedIndexImpl.java:1422) at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:627) at com.intellij.util.indexing.FileBasedIndexImpl.doIndexFileContent(FileBasedIndexImpl.java:1371) at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1325) at com.intellij.util.indexing.contentQueue.IndexUpdateRunner.lambda$indexOneFileOfJob$5(IndexUpdateRunner.java:267) 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:75) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:158) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:115) 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:112) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:75) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:486) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.executeSynchronously(NonBlockingReadActionImpl.java:421) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl.executeSynchronously(NonBlockingReadActionImpl.java:186) at com.intellij.util.indexing.contentQueue.IndexUpdateRunner.indexOneFileOfJob(IndexUpdateRunner.java:270) at com.intellij.util.indexing.contentQueue.IndexUpdateRunner.lambda$indexJobsFairly$4(IndexUpdateRunner.java:210) at com.intellij.openapi.progress.impl.ProgressSuspender.executeNonSuspendableSection(ProgressSuspender.java:83) at com.intellij.util.indexing.contentQueue.IndexUpdateRunner.indexJobsFairly(IndexUpdateRunner.java:213) at com.intellij.util.indexing.contentQueue.IndexUpdateRunner.lambda$doIndexFiles$3(IndexUpdateRunner.java:147) 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.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213) at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:214) 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)

Odoo code is at https://github.com/odoo/odoo/tree/0ea254e973fee897b26477cce6f5c2cf64ddbd4b.

PyCharm version PyCharm 2021.3.2 (Community Edition) Build #PC-213.6777.50, built on January 27, 2022 Runtime version: 11.0.13+7-b1751.25 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.4.0-97-generic GC: G1 Young Generation, G1 Old Generation Memory: 750M Cores: 8 Registry: indexer.follows.symlinks=false Non-Bundled Plugins: com.jetbrains.plugins.ini4idea (213.5744.190) com.intellij.ideolog (203.0.27.0) com.alayouni.ansiHighlight (1.2.4) codes.rudolph.idea.cfg (0.3.1) at.wtioit.intellij.plugins.odoo (0.5.7) Current Desktop: ubuntu:GNOME

Let me know if you need anything else.

Note that at first contacted contact@wt-io-it.at because PyCharm's error popup image shows only the link to https://www.wt-io-it.at/. Having the link to this repository directly in PyCharm's popup might save some time for future contributors and https://www.wt-io-it.at/.

Thanks for creating this plugin :)

ap-wtioit commented 2 years ago

@SimoRubi thanks for reporting the error. I could not reproduce it in my workspace with the commit and version you referenced, but that could be expected as the indexing works differently every time. I still might have an idea what went wrong and will provide a fix ASAP (hopefully a SNAPSHOT version tomorrow and a marketplace release next week).

Details (mostly as a reminder to myself):

Update: i managed to reproduce the exact stacktrace with the following procedure:

Working (in progress) branch: https://github.com/wt-io-it/odoo-pycharm-plugin/tree/master-0.5.8_fix_indexing_error

ap-wtioit commented 2 years ago

We seem unable to parse _inherit = self.MODEL_REQUIRED (and others alike) without the full type hierarchy (when using the python pycharm lib) introduced in https://github.com/odoo/odoo/commit/f0481392c6501cae2c38359f526da1eefa451337

bigbear3001 commented 2 years ago

@SimoRubi i just uploaded version 0.5.8 to jetbrains it's pending review. If you don't want to wait for their review you can download the version from here https://github.com/wt-io-it/odoo-pycharm-plugin/tree/v0.5.8 following the alternate instructions for installing. Thanks for taking the time and reporting the issue. Once the new version is approved i (with my company account) will mark the issue as closed.

ap-wtioit commented 2 years ago

0.5.9 (fixing compatibility with 2019.2 and 2019.3) has just been approved and can now be downloaded from the marketplace as well.

SimoRubi commented 2 years ago

Thanks! I installed 0.5.9 and used it all day today, the error has never occurred.