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

Impromptu crash when restarting Spring Service a few times #441

Closed programaths closed 2 years ago

programaths commented 2 years ago

Additional info Did nothing particular except restarting a spring service.

Version information

FWDekker commented 2 years ago

Hi Christian, thanks for reporting this issue!

Could you explain what happened? This will help me find out where the bug is. For example, did the entire IDE crash to desktop, or did you receive a red popup in the corner indicating something went wrong?

programaths commented 2 years ago

It was indeed reported in the corner. The IDE didn't close, nothing apparent besides that message. Unfortunately, I thought it would send the stack trace and clicked "Send and clear" or something like that.

If it crashes again, I'll try to copy some more info.

Also, I was doing nothing with the plugin. Just launching a Spring config multiple time.

programaths commented 2 years ago

It crashed again, but I have the stack trace:

com.intellij.diagnostic.PluginException: Cannot init component state (componentName=StringSettings, componentClass=StringSettings) [Plugin: com.fwdekker.randomness]
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:148)
    at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:48)
    at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:535)
    at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:55)
    at com.intellij.serviceContainer.ServiceComponentAdapter.access$createAndInitialize(ServiceComponentAdapter.kt:12)
    at com.intellij.serviceContainer.ServiceComponentAdapter$doCreateInstance$1.compute(ServiceComponentAdapter.kt:45)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:238)
    at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:44)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:119)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:73)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:66)
    at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:609)
    at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:583)
    at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)
    at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)
    at com.fwdekker.randomness.string.StringSettings$Companion.getDefault(StringSettings.kt:206)
    at com.fwdekker.randomness.string.StringSettingsAction$StringQuickSwitchSchemeAction.<init>(StringActions.kt:121)
    at com.fwdekker.randomness.string.StringSettingsAction$StringQuickSwitchSchemeAction.<init>(StringActions.kt)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:844)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:900)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:201)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:186)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getActionImpl(ActionManagerImpl.java:527)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:516)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1707)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at com.intellij.ide.util.gotoByName.GotoActionItemProvider.processItems(GotoActionItemProvider.java:280)
    at com.intellij.ide.util.gotoByName.GotoActionItemProvider.processActions(GotoActionItemProvider.java:235)
    at com.intellij.ide.util.gotoByName.GotoActionItemProvider.filterElements(GotoActionItemProvider.java:94)
    at com.intellij.ide.actions.searcheverywhere.ActionSearchEverywhereContributor.lambda$fetchWeightedElements$1(ActionSearchEverywhereContributor.java:99)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.ide.actions.searcheverywhere.ActionSearchEverywhereContributor.fetchWeightedElements(ActionSearchEverywhereContributor.java:98)
    at com.intellij.ide.actions.searcheverywhere.MixedResultsSearcher$ContributorSearchTask.run(MixedResultsSearcher.java:178)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
    at com.intellij.util.ConcurrencyUtil.lambda$underThreadNameRunnable$3(ConcurrencyUtil.java:200)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:297)
    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)
Caused by: com.intellij.util.xmlb.XmlSerializationException: Cannot deserialize class com.fwdekker.randomness.string.StringSettings
    at com.intellij.configurationStore.JdomSerializerImpl.deserialize(xmlSerializer.kt:99)
    at com.intellij.configurationStore.DefaultStateSerializerKt.deserializeState(DefaultStateSerializer.kt:29)
    at com.intellij.configurationStore.StateStorageBase.deserializeState(StateStorageBase.kt:35)
    at com.intellij.configurationStore.StateGetterImpl.getState(StorageBaseEx.kt:56)
    at com.intellij.configurationStore.ComponentStoreImpl.doInitComponent(ComponentStoreImpl.kt:422)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:373)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:119)
    ... 59 more
Caused by: java.util.NoSuchElementException: List is empty.
    at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:212)
    at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:196)
    at com.intellij.serialization.BaseBeanBindingKt.createUsingKotlin(BaseBeanBinding.kt:49)
    at com.intellij.serialization.BaseBeanBindingKt.access$createUsingKotlin(BaseBeanBinding.kt:1)
    at com.intellij.serialization.BaseBeanBinding.newInstance(BaseBeanBinding.kt:34)
    at com.intellij.serialization.xml.KotlinAwareBeanBinding.newInstance(KotlinAwareBeanBinding.kt:76)
    at com.intellij.util.xmlb.BeanBinding.deserialize(BeanBinding.java:142)
    at com.intellij.util.xmlb.NotNullDeserializeBinding.deserializeUnsafe(NotNullDeserializeBinding.java:20)
    at com.intellij.util.xmlb.Binding.deserializeList(Binding.java:29)
    at com.intellij.util.xmlb.OptionTagBinding.deserialize(OptionTagBinding.java:109)
    at com.intellij.util.xmlb.BasePrimitiveBinding.deserializeUnsafe(BasePrimitiveBinding.java:55)
    at com.intellij.util.xmlb.BeanBinding.deserializeInto(BeanBinding.java:246)
    at com.intellij.util.xmlb.BeanBinding.deserializeInto(BeanBinding.java:200)
    at com.intellij.util.xmlb.BeanBinding.deserialize(BeanBinding.java:143)
    at com.intellij.configurationStore.JdomSerializerImpl.deserialize(xmlSerializer.kt:93)
    ... 65 more
FWDekker commented 2 years ago

Do you still have this issue after restarting your IDE? I know this error sometimes happens after updating plugins without restarting the IDE.

Otherwise, would you be willing and able to share the run configuration and/or the project in which this issue happens?

programaths commented 2 years ago

I can't share the project, not only it's big, but also under NDA ^^

As for the run configuration, it's a SpringBoot application with a yaml configuration.

Also, the plugin works, because I can generate random string and UUID, though it seems it does not honor my previous configuration where I set the length of the string to 70. So, I bet it's due to an update and it can't read the previous configuration! It also matches the StackTrace.

Relaunched and before the crash, generated a string and it did honour the 70 chars length. So definitely something around the config I created!!

I think it's due to the fact I had two different project open. Can't reproduce anymore, but keeping an eye on it.

FWDekker commented 2 years ago

I can't share the project, not only it's big, but also under NDA ^^

Not a problem, I understand.

Relaunched and before the crash, generated a string and it did honour the 70 chars length. So definitely something around the config I created!!

I think you're right that there must have been something wacky going on in the configuration; this wouldn't be the first such issue. Looking at the changes between v2.7.4 and v2.7.5, I added two new properties to the settings, but the fact that those are missing should not be a problem when reading the configuration.

Can't reproduce anymore, but keeping an eye on it.

If you no longer have the exception, then that probably means that once you saved your Randomness settings, the corrupted settings file was overwritten with a valid configuration. If, however, this exception or a similar one starts popping up again, I would appreciate it if you could share the file ~/.config/JetBrains/<your IDE>/options/randomness.xml.


Unfortunately, since you said the bug is no longer reproduceable, and it's not possible to test dynamic plugin updating, I think it's best to close this issue. I'll do my best to make future releases (specifically v3 and newer) more resilient to corrupted configurations.

Please let me know if you have additional comments or updates, or if you think it's better to keep the issue opened.