FWDekker / intellij-randomness

IntelliJ plugin for inserting random numbers, UUIDs, names, IP addresses, and much more
https://plugins.jetbrains.com/plugin/9836-randomness
MIT License
45 stars 7 forks source link

Exception on 'Insert Data' activation by shortcut #445

Closed VladRassokhin closed 1 year ago

VladRassokhin commented 2 years ago

Additional info I've activated Alt+R in freshly opened project, seems it was still indexing something.

Stacktraces

Stacktrace 1/1

```java com.intellij.diagnostic.PluginException: 468 ms to call on BGT precache-slow-data@PopupActionupdate@keyboard shortcut (com.fwdekker.randomness.PopupAction). Revise AnAction.getActionUpdateThread property [Plugin: com.fwdekker.randomness] at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23) at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:83) at com.intellij.openapi.actionSystem.impl.ActionUpdater.ensureSlowDataKeysPreCached(ActionUpdater.java:485) at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$callAction$5(ActionUpdater.java:202) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1086) at com.intellij.openapi.actionSystem.impl.ActionUpdater.callAction(ActionUpdater.java:202) at com.intellij.openapi.actionSystem.impl.ActionUpdater.callAction(ActionUpdater.java:161) at com.intellij.openapi.actionSystem.impl.ActionUpdater.updateActionReal(ActionUpdater.java:137) at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$new$0(ActionUpdater.java:124) at com.intellij.openapi.actionSystem.impl.ActionUpdater.update(ActionUpdater.java:701) at com.intellij.openapi.actionSystem.impl.ActionUpdater$UpdateSessionImpl.presentation(ActionUpdater.java:810) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doUpdateActionsInner(IdeKeyEventDispatcher.java:674) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:621) at com.intellij.openapi.actionSystem.impl.Utils.lambda$runUpdateSessionForInputEvent$15(Utils.java:741) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1086) at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$tryRunReadActionAndCancelBeforeWrite$17(ActionUpdater.java:428) at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:63) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128) at com.intellij.openapi.actionSystem.impl.ActionUpdater.tryRunReadActionAndCancelBeforeWrite(ActionUpdater.java:424) at com.intellij.openapi.actionSystem.impl.Utils.lambda$runUpdateSessionForInputEvent$16(Utils.java:741) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:774) at com.intellij.openapi.actionSystem.impl.Utils.lambda$runUpdateSessionForInputEvent$18(Utils.java:748) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:591) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:666) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:622) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:590) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.actionSystem.impl.Utils.lambda$runUpdateSessionForInputEvent$20(Utils.java:747) at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:243) at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29) at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:216) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212) at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:205) 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) ```

Version information

FWDekker commented 2 years ago

Hi Vlad! Thank you for reporting the exception :-)

It looks like the exception informs me that I should use a thread to handle the action to make sure it does not get affected by slowdowns during indexing. I will add it to the backlog, but it has relatively low priority.

FWDekker commented 1 year ago

I've looked into this some more. The problem seems to be that PopupAction is too slow to update in the background. But PopupAction literally only changes two variables, and the "heaviest" operation is probably event.getData. The documentation confirms that this is light-weight enough for update.

Therefore, I will consider this a false-positive / bug in IntelliJ's reporting, as this exception should not be thrown while indexing.

Please let me know if this exception is continuously bothering you. Even if I think it's IntelliJ's fault, I could try to find a way around this so that you don't get bothered by exceptions ^^