Plugin disabled after update in 2019.3 when plugin has a global inspection registered

Answered

Hi,

 

We have a plugin with a globalInspection registered in its xml.

It was working fine in previous versions of IJ.

With 2019.3, the inspection still works fine, however, when a user updates the plugin to a new version, an exception is logged to idea.log, and after restart, the plugin is disabled. 

 

2019-12-22 09:52:23,911 [ 54342] INFO - rationStore.ComponentStoreImpl - Saving Module: 'kotlin_test'FacetManager took 25 ms
2019-12-22 09:52:23,961 [ 54392] WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.idea.perforce.perforce.ConnectionId
2019-12-22 09:52:24,038 [ 54469] INFO - rationStore.ComponentStoreImpl - Saving Project (name=intellij, containerState=ACTIVE, componentStore=/Users/avichaylibeskindmulyan/codota-dev/codota-intellij-lean) WindowStateProjectService took 42 ms
2019-12-22 09:52:24,067 [ 54498] WARN - mponents.impl.stores.StoreUtil - Save settings failed
java.lang.RuntimeException: Cannot save scheme inspectionProfiles/Project Default
at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.save(SchemeManagerImpl.kt:316)
at com.intellij.configurationStore.schemeManager.SchemeManagerFactoryBase.save(SchemeManagerFactoryImpl.kt:96)
at com.intellij.configurationStore.ComponentStoreWithExtraComponents$saveSettingsSavingComponentsAndCommitComponents$2$1.invokeSuspend(ComponentStoreWithExtraComponents.kt:61)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
at com.intellij.configurationStore.EdtPoolDispatcherManager.processQueue(EdtPoolDispatcher.kt:54)
at com.intellij.configurationStore.EdtPoolDispatcherManager.access$processQueue(EdtPoolDispatcher.kt:18)
at com.intellij.configurationStore.EdtPoolDispatcherManager$scheduleFlush$1.invoke(EdtPoolDispatcher.kt:32)
at com.intellij.configurationStore.EdtPoolDispatcherManager$scheduleFlush$1.invoke(EdtPoolDispatcher.kt:18)
at com.intellij.configurationStore.EdtPoolDispatcherKt$sam$java_lang_Runnable$0.run(EdtPoolDispatcher.kt)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:309)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:441)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:906)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:779)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:687)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:963)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:193)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:179)
at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:455)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:453)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:82)
at com.intellij.openapi.progress.impl.CoreProgressManager.runSynchronously(CoreProgressManager.java:318)
at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:303)
at com.intellij.configurationStore.SaveAndSyncHandlerImpl.saveSettingsUnderModalProgress(SaveAndSyncHandlerImpl.kt:212)
at com.intellij.openapi.project.impl.ProjectManagerImpl.closeProject(ProjectManagerImpl.java:740)
at com.intellij.openapi.project.impl.ProjectManagerImpl.closeAndDisposeAllProjects(ProjectManagerImpl.java:688)
at com.intellij.openapi.application.impl.ApplicationImpl.disposeSelf(ApplicationImpl.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.doExit(ApplicationImpl.java:655)
at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:628)
at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:617)
at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:613)
at com.intellij.ide.plugins.newui.RestartButton.lambda$null$0(RestartButton.java:33)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:107)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:116)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
at com.intellij.ide.plugins.newui.RestartButton.lambda$new$1(RestartButton.java:33)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6651)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6416)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:906)
at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:844)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:776)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.desktop/java.awt.Dialog.show(Dialog.java:1063)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:708)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:433)
at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1698)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1657)
at com.intellij.openapi.options.newEditor.SettingsDialog.lambda$show$0(SettingsDialog.java:86)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:149)
at com.intellij.openapi.options.newEditor.SettingsDialog.show(SettingsDialog.java:86)
at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:84)
at com.intellij.ide.actions.ShowSettingsAction.perform(ShowSettingsAction.java:54)
at com.intellij.ui.mac.MacOSApplicationProvider$Worker.lambda$null$1(MacOSApplicationProvider.java:66)
at com.intellij.ui.mac.MacOSApplicationProvider$Worker.lambda$submit$7(MacOSApplicationProvider.java:162)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:68)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:441)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:906)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:779)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.intellij.diagnostic.PluginException: com.codota.intellij.lean.local.LocalLearningBatchInspection [Plugin: com.codota.csp.intellij]
at com.intellij.serviceContainer.PlatformComponentManagerImpl.instantiateExtensionWithPicoContainerOnlyIfNeeded(PlatformComponentManagerImpl.kt:522)
at com.intellij.serviceContainer.BaseKeyedLazyInstance.createInstance(BaseKeyedLazyInstance.java:57)
at com.intellij.openapi.extensions.CustomLoadingExtensionPointBean.createInstance(CustomLoadingExtensionPointBean.java:31)
at com.intellij.codeInspection.InspectionEP.instantiateTool(InspectionEP.java:200)
at com.intellij.codeInspection.ex.InspectionToolWrapper.getTool(InspectionToolWrapper.java:71)
at com.intellij.codeInspection.ex.ScopeToolState.areSettingsEqual(ScopeToolState.java:125)
at com.intellij.codeInspection.ex.ScopeToolState.equalTo(ScopeToolState.java:118)
at com.intellij.codeInspection.ex.ToolsImpl.equals(ToolsImpl.java:462)
at com.intellij.openapi.util.Comparing.equal(Comparing.java:31)
at com.intellij.codeInspection.ex.InspectionProfileImpl.toolSettingsAreEqual(InspectionProfileImpl.java:105)
at com.intellij.codeInspection.ex.InspectionProfileImpl.getChangedToolNames(InspectionProfileImpl.java:827)
at com.intellij.codeInspection.ex.InspectionProfileImpl.writeExternal(InspectionProfileImpl.java:221)
at com.intellij.codeInspection.ex.InspectionProfileImpl.writeScheme(InspectionProfileImpl.java:194)
at com.intellij.configurationStore.LazySchemeProcessor.writeScheme(scheme-impl.kt:63)
at com.intellij.configurationStore.LazySchemeProcessor.writeScheme(scheme-impl.kt:54)
at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.saveScheme(SchemeManagerImpl.kt:373)
at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.save(SchemeManagerImpl.kt:313)
... 126 more
Caused by: java.lang.ClassNotFoundException: com.codota.intellij.lean.local.LocalLearningBatchInspection
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:307)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at com.intellij.serviceContainer.PlatformComponentManagerImpl.instantiateExtensionWithPicoContainerOnlyIfNeeded(PlatformComponentManagerImpl.kt:519)
... 142 more

 

com.codota.intellij.lean.local.LocalLearningBatchInspection is a valid class that's in our jar, however, it seems IJ tries to use it after it has been removed from the classpath or something like that.

 

Any advice on how to resolve?

 

Thanks

Amir

8 comments
Comment actions Permalink

The missing class is not necessarily the one shown in the stack trace but one that the constructor of the shown class is using.

I had this type of error reported on some user systems, which was confusing because the class named in the stack trace did exist, instead it was the class it was using which was missing.

I cannot be sure that your case is 100% that but it sure seems that way. 

 

0
Comment actions Permalink

Thanks for the feedback, Vladimir.

 

I doubt that this is the case for me - this class works fine in the same specific ide.
Only when I upgrade to a new plugin version does this error occur.

 

Thanks

Amir

0
Comment actions Permalink

Vladimir Schneider I think the scenario you describe sounds more like a NoClassDefFoundError rather than a ClassNotFoundException as is the case described here.

0
Comment actions Permalink

Isn't the difference between the two only in how the class in question is loaded? If you use reflection Class.forName then you get the exception. If you reference the class directly, you get the error.

0
Comment actions Permalink

Vladimir Schenev Yes, but that's why they differ. As far as I understand, a NoClassDefFoundError might be thrown because the loaded class failed to initialize due to some other missing class (e.g. in a static initializer). When loading the Class object via a class loader this cannot happen.

0
Comment actions Permalink

Just to add more info - 

This has to do with the new dynamic plugins support in 2019.3.

It seems that our plugin is considered to be dynamic, because all our components and extensions are registered under optional dependencies.
You see, our plugin support both JAVA and JAVASCRIPT and so we load components based on available dependencies.

It seems these components are not considered when deciding whether the plugin can be dynamically loaded/unloaded.

This sounds like a bug to me - the plugin cannot be unloaded in such a case.

 

Best regards,

Amir

0
Comment actions Permalink

Amir, I can also see some strange exception reports for my plugin which could only happen if the plugin or some of its classes are unloaded and re-loaded.

I had an old implementation of element type registry that was a Kotlin object instead of an application service. In 2019.3 I am seeing this object being re-initialized 2, 3, 4 and more times. The only way I could see this happening if the plugin is unloaded and loaded again with a different class loader or at least this singleton object is unloaded and loaded again to cause it to re-initialize.

 

0
Comment actions Permalink

Amir could you please file a bug in YouTrack about this dynamic plugin problem? Thanks. https://youtrack.jetbrains.com/issues/IDEA

0

Please sign in to leave a comment.