lppedd / idea-conventional-commit

Context and template-based completion for conventional/semantic commits.
https://plugins.jetbrains.com/plugin/13389-conventional-commit
MIT License
327 stars 19 forks source link

Error reading custom defaults file. Using built-in ones. #143

Closed Clashsoft closed 1 week ago

Clashsoft commented 1 month ago

This keeps appearing whenever I type anything in the commit message field. There is no error message or anything in the log.

image

This is the config (nothing changed from the defaults):

image

IntelliJ IDEA 2024.1.1 (Ultimate Edition)
Build #IU-241.15989.150, built on April 29, 2024
Licensed to Adrian Kunz
Subscription is active until October 8, 2024.
For educational use only.
Runtime version: 17.0.10+1-b1207.14 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4070M
Cores: 20
Registry:
  debugger.click.disable.breakpoints=true
  ide.experimental.ui=true
  terminal.new.ui=true
Non-Bundled Plugins:
  com.github.lppedd.idea-conventional-commit (0.23.1)
  com.vecheslav.darculaDarkerTheme (1.2.0)
  com.intellij.properties.bundle.editor (241.14494.150)
  com.nasller.CodeGlancePro (1.8.5)
  String Manipulation (9.13.0)
  com.wakatime.intellij.plugin (14.3.13)
  com.jetbrains.packagesearch.intellij-plugin (241.0.9)
  com.github.copilot (1.5.4.5571)
  mobi.hsz.idea.gitignore (4.5.3)
Kotlin: 241.15989.150-IJ
lppedd commented 1 month ago

Hey! Try this custom build with a logging point.
When it happens you should find an exception logged too.

idea-conventional-commit-0.23.1.zip

Clashsoft commented 1 month ago

Thank you. So far I was not able to reproduce the problem with that version....

lppedd commented 1 month ago

Hey! Let me know if I can close this!

Clashsoft commented 1 month ago

Feel free to close. I will reopen if it ever occurs again :)

Clashsoft commented 1 week ago

I finally got this exception again. Here is the stacktrace:

2024-06-21 19:10:28,161 [ 717377] SEVERE - #com.github.lppedd.cc.api.impl.InternalCommitTokenProvider - Error while reading custom tokens file
java.lang.Throwable: Control-flow exceptions (e.g. this class com.intellij.openapi.progress.ProcessCanceledException) should never be logged. Instead, these should have been rethrown if caught.
    at com.intellij.openapi.diagnostic.Logger.ensureNotControlFlow(Logger.java:513)
    at com.intellij.idea.IdeaLogger.doLogError(IdeaLogger.java:154)
    at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:145)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:423)
    at com.github.lppedd.cc.api.impl.InternalCommitTokenProvider.getDefaults(InternalCommitTokenProvider.kt:34)
    at com.github.lppedd.cc.api.impl.InternalCommitTokenProvider.getCommitTypes(InternalCommitTokenProvider.kt:46)
    at com.github.lppedd.cc.completion.providers.TypeCompletionProvider$complete$1$1.invoke(TypeCompletionProvider.kt:43)
    at com.github.lppedd.cc.completion.providers.TypeCompletionProvider$complete$1$1.invoke(TypeCompletionProvider.kt:42)
    at com.github.lppedd.cc.CCExtensionsKt$sam$i$java_util_concurrent_Callable$0.call(CCExtensions.kt)
    at com.intellij.openapi.application.ex.ApplicationUtil.runWithCheckCanceled$lambda$3$lambda$1(ApplicationUtil.kt:57)
    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.application.ex.ApplicationUtil.runWithCheckCanceled$lambda$3(ApplicationUtil.kt:54)
    at com.intellij.openapi.application.ex.ApplicationUtil$runWithCheckCanceled$deferred$1.invokeSuspend(ApplicationUtil.kt:74)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: com.intellij.openapi.progress.ProcessCanceledException
    at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.throwIfCanceled(AbstractProgressIndicatorBase.java:172)
    at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.checkCanceled(AbstractProgressIndicatorBase.java:165)
    at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.checkCanceled(AbstractProgressIndicatorExBase.java:98)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.checkCancelledEvenWithPCEDisabled(ProgressIndicatorUtils.java:438)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:368)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.awaitWithCheckCanceled(ProgressIndicatorUtils.java:362)
    at com.intellij.openapi.vfs.DiskQueryRelay.accessDiskWithCheckCanceled(DiskQueryRelay.java:61)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.getAttributes(LocalFileSystemBase.java:722)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.getAttributes(LocalFileSystemImpl.java:300)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.isDirectory(LocalFileSystemBase.java:180)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findChild(VirtualDirectoryImpl.java:91)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.refreshAndFindChild(VirtualDirectoryImpl.java:351)
    at com.intellij.openapi.vfs.newvfs.VfsImplUtil.refreshAndFindFileByPath(VfsImplUtil.java:118)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.refreshAndFindFileByPath(LocalFileSystemBase.java:125)
    at com.github.lppedd.cc.configuration.CCDefaultTokensService.findDefaultFilePathFromProjectRoot(CCDefaultTokensService.kt:140)
    at com.github.lppedd.cc.configuration.CCDefaultTokensService.getDefaultsFromCustomFile(CCDefaultTokensService.kt:60)
    at com.github.lppedd.cc.api.impl.InternalCommitTokenProvider.getDefaults(InternalCommitTokenProvider.kt:32)
    ... 20 more
lppedd commented 1 week ago

Looks like the culprit is com.intellij.openapi.vfs.DiskQueryRelay.accessDiskWithCheckCanceled.

The "process" is cancelled. The problem is, who cancelled this "process"?

lppedd commented 1 week ago

I might have to find an alternative way to access the file on disk, or loop until the file is read despite the ProcessCancelledException.

Clashsoft commented 1 week ago

Do you read the file on every keystroke? It seems that way from when the exceptions occur. Maybe there is some debounce / canceling behavior going on.

lppedd commented 1 week ago

Ok, it has been a while I haven't worked on IJ plugins, so I lost some of my knowledge.
The problem is this line

} catch (e: Exception) {

Exception is too generic, ProcessCancelledExceptions should not be caught, they should propagate to the top and be handled by the platform.