Bug 406517 - Detected recursive attempt for Navigation history implementation
Summary: Detected recursive attempt for Navigation history implementation
Status: CLOSED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2013-04-25 05:23 EDT by saurav sarkar CLA
Modified: 2013-04-25 14:00 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description saurav sarkar CLA 2013-04-25 05:23:29 EDT
Hi All,

I keep getting this error in 3.7 while opening of my editor

Warning: Detected recursive attempt by part com.sap.adt.wda.view.ui.test.vieweditor to create itself (this is probably, but not necessarily, a bug)

But this problems seems to be resolved in 4.2
What I could make out the reason in 4.2 is the Compatibility editor only creates the part control once the editor is fully initialized which was not happening in 3.7.

The error is thrown from here in WorkbenchPartReference

 if (part == null && restore) {
            
            if (state == STATE_CREATION_IN_PROGRESS) {
                IStatus result = WorkbenchPlugin.getStatus(
                        new PartInitException(NLS.bind("Warning: Detected recursive attempt by part {0} to create itself (this is probably, but not necessarily, a bug)",  //$NON-NLS-1$
                                getId())));
                WorkbenchPlugin.log(result);
                return null;
            }
  
 try {
                state = STATE_CREATION_IN_PROGRESS;
                
                IWorkbenchPart newPart = createPart();

Inside the createPart() again the reference to find the editor is done from 
The Navigation Location classes.

Is this a valid issue in 3.7. Was this one consciously fixed in 4.2 ? 

cheers,
Saurav
Comment 1 Paul Webster CLA 2013-04-25 08:02:51 EDT
What's the stack trace when it hits the recursive activation?

PW
Comment 2 saurav sarkar CLA 2013-04-25 09:10:18 EDT
(In reply to comment #1)
> What's the stack trace when it hits the recursive activation?
> 
> PW

Please find the stack trace below

org.eclipse.ui.PartInitException: Warning: Detected recursive attempt by part adtie.wda.controller.ui.editor to create itself (this is probably, but not necessarily, a bug)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:586)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
	at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:424)
	at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:402)
	at org.eclipse.ui.internal.WorkbenchPage.findEditor(WorkbenchPage.java:2178)
	at org.eclipse.ui.NavigationLocation.getEditorPart(NavigationLocation.java:44)
	at adtie.wda.controller.ui.navigation.ControllerEditorNavigationLocation.getText(ControllerEditorNavigationLocation.java:95)
	at org.eclipse.ui.internal.NavigationHistoryEntry.<init>(NavigationHistoryEntry.java:49)
	at org.eclipse.ui.internal.NavigationHistory.createEntry(NavigationHistory.java:657)
	at org.eclipse.ui.internal.NavigationHistory.addEntry(NavigationHistory.java:374)
	at org.eclipse.ui.internal.NavigationHistory.markLocation(NavigationHistory.java:214)
	at adtie.wda.controller.ui.editors.ControllerEditor.pageChange(ControllerEditor.java:432)
	at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1067)
	at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:603)
	at adtie.tools.core.ui.editors.AdtFormEditor.setActivePage(AdtFormEditor.java:152)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:352)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
	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:1245)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
	at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
	at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
	at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
	at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
	at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
	at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2942)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:1109)
	at adtie.tools.core.ui.internal.navigation.NavigationService.openEditorWithMarker(NavigationService.java:224)
	at adtie.tools.core.ui.internal.navigation.NavigationService.openEditor(NavigationService.java:185)
	at adtie.tools.core.ui.internal.navigation.NavigationService.navigate(NavigationService.java:123)
	at adtie.projectexplorer.ui.internal.action.AbapRepositoryObjectActionProvider$1.run(AbapRepositoryObjectActionProvider.java:81)
	at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
	at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
	at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at adtie.product.branding.internal.application.AdtApplication.start(AdtApplication.java:70)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:344)
	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:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
!SUBENTRY 1 org.eclipse.ui 4 0 2013-04-25 10:16:41.074
!MESSAGE Warning: Detected recursive attempt by part adtie.wda.controller.ui.editor to create itself (this is probably, but not necessarily, a bug)
Comment 3 Paul Webster CLA 2013-04-25 09:22:06 EDT
The problem is that ControllerEditor.pageChange is marking the location even during that first setActive(*), when it really doesn't need to (The act of creating the part will add a navigation entry to the navigation history).

Because the part isn't fully initialized yet EditorReference.getEditor(*) is going to try and create it, and that's where you get the recursive warning.

The reason it doesn't cause a problem in 4.2 is the part lifecycle was completely re-worked.

PW
Comment 4 saurav sarkar CLA 2013-04-25 09:30:08 EDT
Thanks Paul for the comments.

But how can i stop from creating an entry for the first time ?
I only get a chance to mark the location once the page is changed.
Comment 5 Paul Webster CLA 2013-04-25 09:42:12 EDT
I don't know the structure of your editors, but can't you know in ControllerEditor.pageChange(*) the first time you're called and don't mark the location?

PW
Comment 6 saurav sarkar CLA 2013-04-25 14:00:56 EDT
I could stop marking of location using the combination of a boolean variable and a  first page index checking.

Closing this bug.

Thanks a lot Paul for your help.

cheers,
Saurav