Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Constraint inSmartMode cannot be satisfied #1373

Open
ksdev-pl opened this issue Aug 26, 2024 · 19 comments
Open
Assignees
Labels
bug Something isn't working qute Qute support

Comments

@ksdev-pl
Copy link

ksdev-pl commented Aug 26, 2024

Hello

image

java.lang.IllegalStateException: Constraint inSmartMode cannot be satisfied
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:554)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.executeSynchronously(NonBlockingReadActionImpl.java:492)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl.executeSynchronously(NonBlockingReadActionImpl.java:220)
	at com.intellij.psi.impl.search.JavaFunctionalExpressionSearcher.calcDescriptors(JavaFunctionalExpressionSearcher.java:112)
	at com.intellij.psi.impl.search.JavaFunctionalExpressionSearcher$Session.processResults(JavaFunctionalExpressionSearcher.java:498)
	at com.intellij.psi.impl.search.JavaFunctionalExpressionSearcher.processQuery(JavaFunctionalExpressionSearcher.java:72)
	at com.intellij.psi.impl.search.JavaFunctionalExpressionSearcher.processQuery(JavaFunctionalExpressionSearcher.java:62)
	at com.intellij.openapi.application.QueryExecutorBase.execute(QueryExecutorBase.java:76)
	at com.intellij.util.ExecutorsQuery.processResults(ExecutorsQuery.java:30)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.UniqueResultsQuery.processResults(UniqueResultsQuery.java:37)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:75)
	at com.intellij.codeInsight.navigation.ClassImplementationsSearch.processImplementations(ClassImplementationsSearch.java:34)
	at com.intellij.codeInsight.navigation.ClassImplementationsSearch.execute(ClassImplementationsSearch.java:20)
	at com.intellij.codeInsight.navigation.ClassImplementationsSearch.execute(ClassImplementationsSearch.java:16)
	at com.intellij.util.ExecutorsQuery.processResults(ExecutorsQuery.java:30)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.UniqueResultsQuery.processResults(UniqueResultsQuery.java:37)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:100)
	at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
	at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:83)
	at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:75)
	at com.intellij.util.AbstractQuery.findAll(AbstractQuery.java:24)
	at com.intellij.util.Query.iterator(Query.java:127)
	at com.intellij.util.AbstractQuery.iterator(AbstractQuery.java:34)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at com.redhat.devtools.intellij.qute.psi.internal.template.datamodel.DataModelProviderRegistry.scanJavaClasses(DataModelProviderRegistry.java:180)
	at com.redhat.devtools.intellij.qute.psi.internal.template.datamodel.DataModelProviderRegistry.collectDataModel(DataModelProviderRegistry.java:150)
	at com.redhat.devtools.intellij.qute.psi.internal.template.datamodel.DataModelProviderRegistry.getDataModelProject(DataModelProviderRegistry.java:127)
	at com.redhat.devtools.intellij.qute.psi.internal.template.QuarkusIntegrationForQute.getDataModelProject(QuarkusIntegrationForQute.java:64)
	at com.redhat.devtools.intellij.qute.psi.QuteSupportForTemplate.getDataModelProject(QuteSupportForTemplate.java:133)
	at com.redhat.devtools.intellij.qute.lsp.QuteLanguageClient.lambda$getDataModelProject$6(QuteLanguageClient.java:156)
	at com.redhat.devtools.lsp4ij.internal.PromiseToCompletableFuture.lambda$nonBlockingReadActionPromise$2(PromiseToCompletableFuture.java:144)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:840)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:872)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:604)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$4(NonBlockingReadActionImpl.java:567)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:291)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:965)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:93)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:138)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:96)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:96)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:135)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:93)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:567)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:466)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$2(NonBlockingReadActionImpl.java:481)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

The above while opening Quarkus project. I saw it multiple times using nightly build (also while opening project) - I'm reporting as it's also in new stable version (2.0.0).

IntelliJ IDEA 2024.2.0.2 (Ultimate Edition)
Build #IU-242.20224.419, built on August 19, 2024
Runtime version: 21.0.3+13-b509.4 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.X11.XToolkit
Linux 6.10.6-200.fc40.x86_64
Kotlin plugin: K2 mode (Beta)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
  debugger.new.tool.window.layout=true
  vcs.log.index.enable=true
  ide.experimental.ui=true
  terminal.new.ui=true
Non-Bundled Plugins:
  com.supermaven.intellij (1.38)
  com.redhat.devtools.intellij.telemetry (1.2.1.62)
  com.redhat.devtools.lsp4ij (0.4.0)
  AceJump (3.8.19)
  com.intellij.ml.llm (242.20224.424)
  com.redhat.devtools.intellij.quarkus (2.0.0)
  com.jetbrains.packagesearch.intellij-plugin (242.0.12)
Kotlin: 242.20224.419-IJ
Current Desktop: GNOME
@fbricon fbricon added qute Qute support bug Something isn't working labels Aug 26, 2024
@fbricon
Copy link
Contributor

fbricon commented Aug 28, 2024

is your project public? We're having a hard time reproducing this problem.

@ksdev-pl
Copy link
Author

I can make it public but I don't think it will help, as the issue is not repeatable on demand also by me (and the project is very very basic so probably it doesn't matter). When it happens it's unexpected, and when I try to repeat it - opening the project again - I cannot.
In any case there's no issue during work after this exception.
I'll have an eye on it and next time it happens I'll also upload a longer context from Idea logs.

@angelozerr
Copy link
Contributor

Managing correctly lsp features when IJ is opening is a real nightmare because IJ indexes a lot of thing but it call too some feature when editor is opened like validation, codelens document link, etc.

With IJ Quarkus it is harder because codelens, validation etc requires to visit java classes to collect data model like properties for application.properties, java data model for qute etc which must be done sometimes when project is indexing.

It explains why we can have this kind of errors, loosing sometimes some codelens.

We do that to avoid freezing IJ when the IDE is opening.

I think more and more that we should not start language server when IJ is starting, collect all lsp features that must be called for all opened editor like codelens and when IJ is started and indexation is done, we refresh all opened editors.

It is not a trivial issue but I think it should avoid having those kind errors and prevent from little freeze.

This strategy should be used only for IJ Quarkus which have ls which communicate with IJ to visit Java classes but not for other ls.

It is an another sample of LSP API

@ksdev-pl
Copy link
Author

Here's a bigger Idea log around the exception.
The scenario is the same - I changed from one project I had open in Idea to another (quarkus) project.
quarkus-idea.log

@ksdev-pl
Copy link
Author

Logs from another one (while opening the project):
quarkus-idea-2.log

@angelozerr
Copy link
Contributor

Thanks @ksdev-pl for your logs.

To fix all those problems, we need to investigate redhat-developer/lsp4ij#498 but it is not a trivial issue.

@angelozerr
Copy link
Contributor

@ksdev-pl I have installed IJ 2024.2 and now I have this bug(before this bug didn't exist).

I need to find time to try to implement redhat-developer/lsp4ij#498

@angelozerr
Copy link
Contributor

@angelozerr
Copy link
Contributor

You cand find another similar issues at https://youtrack.jetbrains.com/issues?q=Constraint%20inSmartMode&u=1

@angelozerr
Copy link
Contributor

@ksdev-pl could you please try to install the fix that I have tried in LSP4IJ, by installing the build zip that you can download at https://github.com/redhat-developer/lsp4ij/actions/runs/10815015873

See https://github.com/redhat-developer/lsp4ij/?tab=readme-ov-file#testing-the-ci-builds for more explanation how to install this zip

@ksdev-pl
Copy link
Author

I feel uncomfortable answering, as I stopped using the plugin (I got frustrated (again) when a plugin-related issue appeared in a non-quarkus project). I know you guys are doing the best and it's also frustrating for you, especially with Idea quirks and bugs, etc. Be strong and don't give up 😁

@angelozerr
Copy link
Contributor

Ok thanks @ksdev-pl for your answer, I understand. I'm playing with the build zip and it seems that I have no problem.

If you have time, please try it and give me feedback.

@gasper-vrhovsek
Copy link

I also got this exception thrown (along with 2 by LSP4IJ). Attaching the full idea.log.

idea.log

Hope this helps. I've also been noticing really sluggish code completion and syntax highlighting lately. Can't really say which version started exhibiting these slowdowns.

@angelozerr
Copy link
Contributor

angelozerr commented Nov 13, 2024

@gasper-vrhovsek I'm working on this issue really annoying issue with redhat-developer/lsp4ij#570

Thanks for your log.

You have this problem when you are starting your IJ?

@gasper-vrhovsek
Copy link

@angelozerr The exceptions were thrown after several hours of work. Can't say exactly, but it might be the IJ was open for several days. The laggy/sluggish behavior I can notice on a fresh start of IJ. Tried clearing all caches which does not seem to have any impact.

Thank you for your effort on this.

@angelozerr
Copy link
Contributor

angelozerr commented Nov 19, 2024

@ksdev-pl @gasper-vrhovsek could you please install:

and tell me if it is working better. The main idea is to start language servers only when all indexing step is finished for all projects. In this case Qute, Quarkus language servers starts and visit Java classes which are ready to collect data. The IJ startup should be a lot improved.

Any feedback are welcome!

@angelozerr
Copy link
Contributor

@ia3andy please do that also #1373 (comment) and give me feedback. I would like to create a release if there is no problem with this big changes.

@gasper-vrhovsek
Copy link

@angelozerr I installed the intellij-quarkus nightly build, but I'm not sure which lsp4j build should I test. I came to this a bit late because I was busy in the meantime. Let me know which one contains your fix and I'll install it.

@angelozerr
Copy link
Contributor

@angelozerr I installed the intellij-quarkus nightly build, but I'm not sure which lsp4j build should I test. I came to this a bit late because I was busy in the meantime. Let me know which one contains your fix and I'll install it.

See https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-nightly-builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working qute Qute support
Projects
None yet
Development

No branches or pull requests

13 participants
@fbricon @gasper-vrhovsek @angelozerr @ksdev-pl and others