Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 299636

Summary: InvalidRegistryObjectException when working with plugin.xml editor and search results
Product: [Eclipse Project] PDE Reporter: Tomasz Zarna <tomasz.zarna>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: aphung.work, curtis.windatt.public, ed, ekke, error-reports-inbox, g.watson, loskutov, markus.kell.r, Michael_Rennie, ob1.eclipse
Version: 3.6Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Tomasz Zarna CLA 2010-01-14 09:14:19 EST
I20100112-0800

I've got bunch of plugin.xml editors opened and Search view displaying references found for an extension point. Clicking around resulted in the following exception (don't have more detailed steps, sorry):

org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object
	at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:272)
	at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:262)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getExtension(BaseExtensionHandle.java:30)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getUniqueIdentifier(BaseExtensionHandle.java:75)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.getId(PluginExtension.java:186)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.equals(PluginExtension.java:111)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditorOpener.java:134)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.findExactMatch(ManifestEditorOpener.java:51)
	at org.eclipse.pde.internal.ui.search.SearchResult.computeContainedMatches(SearchResult.java:96)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addAnnotations(EditorAnnotationManager.java:222)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addSearchResult(EditorAnnotationManager.java:109)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.setSearchResults(EditorAnnotationManager.java:102)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.startHighlighting(WindowAnnotationManager.java:82)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.access$1(WindowAnnotationManager.java:75)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager$1.partVisible(WindowAnnotationManager.java:64)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:172)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:170)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:253)
	at org.eclipse.ui.internal.WWinPartService$WWinListener.partVisible(WWinPartService.java:62)
	at org.eclipse.ui.internal.PartListenerList2$7.run(PartListenerList2.java:172)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
	at org.eclipse.ui.internal.PartListenerList2.firePartVisible(PartListenerList2.java:170)
	at org.eclipse.ui.internal.PartService.firePartVisible(PartService.java:253)
	at org.eclipse.ui.internal.WorkbenchPagePartList.firePartVisible(WorkbenchPagePartList.java:68)
	at org.eclipse.ui.internal.PartList.partVisible(PartList.java:288)
	at org.eclipse.ui.internal.PartList.access$2(PartList.java:277)
	at org.eclipse.ui.internal.PartList$1.propertyChanged(PartList.java:47)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireInternalPropertyChange(WorkbenchPartReference.java:375)
	at org.eclipse.ui.internal.WorkbenchPartReference.fireVisibilityChange(WorkbenchPartReference.java:536)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:318)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1255)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1208)
	at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:842)
	at org.eclipse.ui.internal.PartStack.access$1(PartStack.java:828)
	at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:138)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:133)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:269)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:278)
	at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
	at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:88)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1074)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1059)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:773)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3276)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2047)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:333)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3524)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2407)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2371)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
Comment 1 Oleg Besedin CLA 2010-01-14 10:56:09 EST
PluginExtension holds on to the IExtension object. The IExtension object can become invalid if the bundle contributing it is unresolved. The handles to registry objects shoudl not be cached, here is the Javadoc from IExtension:

 * These registry objects are intended for relatively short-term use. Clients that 
 * deal with these objects must be aware that they may become invalid if the 
 * declaring plug-in is updated or uninstalled. If this happens, all methods except
 * {@link #isValid()} will throw {@link InvalidRegistryObjectException}.
Comment 2 Markus Keller CLA 2011-05-16 06:10:55 EDT
There are a bunch of similar bugs open, but this bug seems to have spotted the problem (comment #1):
> The handles to registry objects shoudl not be cached

See https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&classification=Eclipse&classification=RT&longdesc_type=allwordssubstr&longdesc=InvalidRegistryObjectException+ManifestEditorOpener.findExactMatch
Comment 3 Curtis Windatt CLA 2011-05-16 14:48:28 EDT
cc'ing Mike as when profiling Eclipse he saw some cached registry objects taking up a significant amount of memory.

We'll try to investigate in 3.8
Comment 4 Ed Willink CLA 2012-02-04 09:01:50 EST
I've just seen this in 3.8M5; any progress ?
Comment 5 Curtis Windatt CLA 2012-02-06 10:54:03 EST
(In reply to comment #4)
> I've just seen this in 3.8M5; any progress ?

No work is being done on this item.  It is marked for 3.8 for consideration during the polish fix period.
Comment 6 Curtis Windatt CLA 2012-09-07 12:52:26 EDT
*** Bug 343749 has been marked as a duplicate of this bug. ***
Comment 7 Curtis Windatt CLA 2012-09-07 12:52:51 EDT
*** Bug 310756 has been marked as a duplicate of this bug. ***
Comment 8 Curtis Windatt CLA 2012-09-07 12:53:19 EDT
*** Bug 219056 has been marked as a duplicate of this bug. ***
Comment 9 Greg Watson CLA 2013-04-25 19:47:38 EDT
Just got the same exception in I20130320-2352. Same stack trace except lines numbers are slightly different.
Comment 10 Andrey Loskutov CLA 2018-01-27 14:18:01 EST
Still in 4.8 M5.

Add some extension like:

   <extension
         point="org.eclipse.ui.activities">
      <activity
            description="Some activity"
            id="PluginA.activity1"
            name="name">
      </activity>
   </extension>

Search for "org.eclipse.ui.activities" references, it will list the extension above.

Change PluginA.activity1 to PluginA.activity2 in the editor and save.

Switch to any other editor and switch back to plugin editor: the exception below is shown.

The problem is that the org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditor, IPluginObject, IDocument) tries to compare the IPluginObject with equality, but the current object remembered by the search is not valid anymore and so equals() will throw an Exception while computing element id.

Ideally the search match should be updated on editor change. If this is not possible, one should at least guard the ManifestEditorOpener.getAttributeMatch from those exceptions.


org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object
	at org.eclipse.core.internal.registry.RegistryObjectManager.basicGetObject(RegistryObjectManager.java:274)
	at org.eclipse.core.internal.registry.RegistryObjectManager.getObject(RegistryObjectManager.java:264)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getExtension(BaseExtensionHandle.java:30)
	at org.eclipse.core.internal.registry.BaseExtensionHandle.getUniqueIdentifier(BaseExtensionHandle.java:83)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.getId(PluginExtension.java:191)
	at org.eclipse.pde.internal.core.plugin.PluginExtension.equals(PluginExtension.java:110)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.getAttributeMatch(ManifestEditorOpener.java:152)
	at org.eclipse.pde.internal.ui.search.ManifestEditorOpener.findExactMatch(ManifestEditorOpener.java:70)
	at org.eclipse.pde.internal.ui.search.SearchResult.computeContainedMatches(SearchResult.java:89)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addAnnotations(EditorAnnotationManager.java:222)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.addSearchResult(EditorAnnotationManager.java:109)
	at org.eclipse.search2.internal.ui.text.EditorAnnotationManager.setSearchResults(EditorAnnotationManager.java:102)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.startHighlighting(WindowAnnotationManager.java:89)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager.access$1(WindowAnnotationManager.java:82)
	at org.eclipse.search2.internal.ui.text.WindowAnnotationManager$1.partVisible(WindowAnnotationManager.java:70)
Comment 11 Andrey Loskutov CLA 2018-01-27 14:19:41 EST
*** Bug 449993 has been marked as a duplicate of this bug. ***
Comment 12 Eclipse Genie CLA 2020-01-18 12:52:26 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.