question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-idempotent computation

See original GitHub issue

Describe the bug I receive very often a fatal IDE error.

java.lang.Throwable: Non-idempotent computation: it returns different results when invoked multiple times or on different threads:
  MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@61e7c7bc}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest} != MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@679cd73b}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}
  which is element of MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@61e7c7bc}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0 and MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@679cd73b}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0
  which is 0th element of [MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@61e7c7bc}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0, MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@1e8842d7}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0] and [MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@679cd73b}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0, MyInstanceElement{myClass=PyClass: QueryDictmember={resolve=PsiParameterizedCachedValue{com.jetbrains.python.codeInsight.PyCustomMember$$Lambda$5486/0x0000000802d66c40@39803054}}node=Element(Py:TARGET_EXPRESSION), myContext=PyClass: HttpRequest}@0]

Recomputation gives [Lcom.intellij.psi.ResolveResult;@27604f35 (class [Lcom.intellij.psi.ResolveResult;) which is different from both values
Recomputation log:
  Resolving PyQualifiedReference(PyReferenceExpression: GET,com.jetbrains.python.psi.resolve.PyResolveContext@147df0e1) of class com.jetbrains.python.psi.impl.references.PyQualifiedReference
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:161)
	at com.intellij.util.IdempotenceChecker.reportFailure(IdempotenceChecker.java:90)
	at com.intellij.util.IdempotenceChecker.checkEquivalence(IdempotenceChecker.java:77)
	at com.intellij.psi.impl.source.resolve.ResolveCache.cache(ResolveCache.java:322)
	at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:249)
	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:95)
	at com.koxudaxi.pydantic.PydanticKt.getResolveElements(Pydantic.kt:239)
	at com.koxudaxi.pydantic.PydanticKt.getResolvedPsiElements(Pydantic.kt:246)
	at com.koxudaxi.pydantic.PydanticDataclassTypeProvider.getPydanticDataclass(PydanticDataclassTypeProvider.kt:62)
	at com.koxudaxi.pydantic.PydanticDataclassTypeProvider.getReferenceExpressionType(PydanticDataclassTypeProvider.kt:26)
	at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeFromProviders(PyReferenceExpressionImpl.java:385)
	at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getType(PyReferenceExpressionImpl.java:219)
	at com.jetbrains.python.psi.types.TypeEvalContext.lambda$getType$0(TypeEvalContext.java:180)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
	at com.jetbrains.python.psi.types.TypeEvalContext.getType(TypeEvalContext.java:169)
	at com.jetbrains.python.psi.impl.references.PyQualifiedReference.resolveInner(PyQualifiedReference.java:81)
	at com.jetbrains.python.psi.impl.references.PyReferenceImpl.multiResolveInner(PyReferenceImpl.java:108)
	at com.jetbrains.python.psi.impl.references.PyReferenceImpl$CachingResolver.resolve(PyReferenceImpl.java:777)
	at com.jetbrains.python.psi.impl.references.PyReferenceImpl$CachingResolver.resolve(PyReferenceImpl.java:772)
	at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolve$1(ResolveCache.java:154)
	at com.intellij.openapi.util.Computable.get(Computable.java:17)
	at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:260)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	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:95)
	at com.jetbrains.python.psi.PyUtil.multiResolveTopPriority(PyUtil.java:514)
	at com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider.tryResolvingWithAliases(PyTypingTypeProvider.java:1383)
	at com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider.tryResolving(PyTypingTypeProvider.java:1372)
	at com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider.resolveToQualifiedNames(PyTypingTypeProvider.java:1438)
	at com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider$Companion.isTypedDict(PyTypedDictTypeProvider.kt:42)
	at com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider$Companion.getTypedDictTypeForCallee(PyTypedDictTypeProvider.kt:111)
	at com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider$Companion.access$getTypedDictTypeForCallee(PyTypedDictTypeProvider.kt:38)
	at com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider.getReferenceExpressionType(PyTypedDictTypeProvider.kt:27)
	at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeFromProviders(PyReferenceExpressionImpl.java:385)
	at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getType(PyReferenceExpressionImpl.java:219)
	at com.jetbrains.python.psi.types.TypeEvalContext.lambda$getType$0(TypeEvalContext.java:180)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:43)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
	at com.jetbrains.python.psi.types.TypeEvalContext.getType(TypeEvalContext.java:169)
	at com.jetbrains.python.inspections.PyCallingNonCallableInspection.isCallable(PyCallingNonCallableInspection.java:92)
	at com.jetbrains.python.inspections.PyCallingNonCallableInspection$Visitor.checkCallable(PyCallingNonCallableInspection.java:70)
	at com.jetbrains.python.inspections.PyCallingNonCallableInspection$Visitor.visitPyCallExpression(PyCallingNonCallableInspection.java:54)
	at com.jetbrains.python.psi.impl.PyCallExpressionImpl.acceptPyVisitor(PyCallExpressionImpl.java:29)
	at com.jetbrains.python.psi.impl.PyBaseElementImpl.accept(PyBaseElementImpl.java:69)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:65)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:346)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:174)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:132)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:121)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:111)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:346)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1091)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:167)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:61)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:49)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitRestElementsAndCleanup(LocalInspectionsPass.java:366)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:208)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:119)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:167)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Environments (please complete the following information):

  • PyCharm Professional 2021.1
  • Ubuntu 20.04.2
  • pydantic==1.7.3
  • Plugin version 0.3.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
koxudaxicommented, May 7, 2021

This plugin searches pydantic dataclass from all python objects. Libraries often use pydantic models. So checking all objects in the library.

I don’t see an error. But, Django is a huge framework. The searching way might not correct.

I will check a better way.

0reactions
pokidoveacommented, May 7, 2021

Yes, this class is from Django package (web framework). It’s a regular python class, even not a dataclass. Strange. How your plugin connected to it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.Throwable: Non-idempotent computation: it returns ...
java.lang.Throwable: Non-idempotent computation: it returns different results when invoked multiple times or on different threads: #670.
Read more >
Non-idempotent computation: it returns different results when ...
Non -idempotent computation: it returns different results when invoked multiple times or on different thread ; Type, Bug B ; Target versions, No...
Read more >
What is an idempotent operation? - Stack Overflow
In computing, an idempotent operation is one that has no additional effect if it is called more than once with the same input...
Read more >
Idempotence - Wikipedia
Idempotence is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result ......
Read more >
Efficient and Fault Tolerant Computation of Partially ... - SBGf
The execution of the task is an idempotent operation, while the consolidation is non idempotent. The focus of this paper is the efficient...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found