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

fix: don't log canceled completion requests' exceptions #981

Merged

Conversation

fbricon
Copy link
Contributor

@fbricon fbricon commented Jun 28, 2023

In IDEA 2023.1 (at least), typing properties in application.properties causes plenty of exceptions being logged in the console:

2023-06-28 11:27:49,830 [  43062]   WARN - com.redhat.devtools.intellij.lsp4ij.operations.completion.LSContentAssistProcessor - null
com.intellij.openapi.progress.ProcessCanceledException
	at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.throwIfCanceled(AbstractProgressIndicatorBase.java:158)
	at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.checkCanceled(AbstractProgressIndicatorBase.java:148)
	at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.checkCanceled(AbstractProgressIndicatorExBase.java:103)
	at com.intellij.openapi.progress.impl.CoreProgressManager.doCheckCanceled(CoreProgressManager.java:141)
	at com.intellij.openapi.progress.ProgressManager.checkCanceled(ProgressManager.java:227)
	at com.intellij.codeInsight.completion.BaseCompletionService$BaseCompletionResultSet.addElement(BaseCompletionService.java:115)
	at com.intellij.codeInsight.completion.CompletionResultSet.addAllElements(CompletionResultSet.java:85)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl$CompletionResultSetImpl.lambda$addAllElements$0(CompletionServiceImpl.java:202)
	at com.intellij.codeInsight.completion.CompletionThreadingBase.withBatchUpdate(CompletionThreadingBase.java:33)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl$CompletionResultSetImpl.addAllElements(CompletionServiceImpl.java:202)
	at com.redhat.devtools.intellij.lsp4ij.operations.completion.LSContentAssistProcessor.fillCompletionVariants(LSContentAssistProcessor.java:74)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributor(CompletionService.java:81)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.lambda$getVariantsFromContributor$0(CompletionServiceImpl.java:333)
	at com.intellij.diagnostic.telemetry.TraceKt.runWithSpan(trace.kt:74)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.getVariantsFromContributor(CompletionServiceImpl.java:332)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:73)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:152)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:144)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:140)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:87)
	at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:23)
	at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributor(CompletionService.java:81)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.lambda$getVariantsFromContributor$0(CompletionServiceImpl.java:333)
	at com.intellij.diagnostic.telemetry.TraceKt.runWithSpan(trace.kt:74)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.getVariantsFromContributor(CompletionServiceImpl.java:332)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:73)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:56)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:132)
	at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:48)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.lambda$performCompletion$1(CompletionServiceImpl.java:351)
	at com.intellij.diagnostic.telemetry.TraceKt.runWithSpan(trace.kt:74)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.performCompletion(CompletionServiceImpl.java:340)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$11(CompletionProgressIndicator.java:870)
	at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:199)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:112)
	at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:719)
	at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:198)
	at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:43)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:866)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:854)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:374)
	at io.opentelemetry.context.Context.lambda$wrap$1(Context.java:212)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:169)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1102)
	at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:167)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$8(CodeCompletionHandlerBase.java:365)
	at io.opentelemetry.context.Context.lambda$wrap$1(Context.java:212)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:92)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:88)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:252)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

In this fix, we just rethrow the ProcessCanceledException during completion.

@fbricon fbricon added bug Something isn't working enhancement New feature or request completion labels Jun 28, 2023
@fbricon fbricon added this to the 1.21.0 milestone Jun 28, 2023
@fbricon fbricon removed the enhancement New feature or request label Jun 28, 2023
@fbricon fbricon force-pushed the quiet-cancelled-completions branch from 2b7288e to 9d5547b Compare June 28, 2023 10:18
@fbricon fbricon force-pushed the quiet-cancelled-completions branch from 9d5547b to b8a33cf Compare June 28, 2023 10:19
@sonarcloud
Copy link

sonarcloud bot commented Jun 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@angelozerr angelozerr merged commit aaa91bf into redhat-developer:main Jun 28, 2023
@angelozerr
Copy link
Contributor

Thanks @fbricon !

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

Successfully merging this pull request may close these issues.

2 participants