Community
Participate
Working Groups
Build 3.0[20030611] When saving editor contents, error dialog 'save failed reason: null' popped up. In log following entry got logged: !ENTRY org.eclipse.ui 4 4 Jun 16, 2003 15:49:23.534 !MESSAGE Save Failed Save Failed Reason: !ENTRY org.eclipse.ui 2 0 Jun 16, 2003 15:49:23.554 !MESSAGE Save Failed !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.doSaveDoc ument(CompilationUnitDocumentProvider.java:909) at org.eclipse.ui.texteditor.AbstractDocumentProvider.saveDocument (AbstractDocumentProvider.java:459) at org.eclipse.ui.texteditor.AbstractTextEditor$11.execute (AbstractTextEditor.java:3072) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run (WorkspaceModifyOperation.java:71) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1595) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:85) at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation (AbstractTextEditor.java:3092) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSaveOperatio n(CompilationUnitEditor.java:754) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave (CompilationUnitEditor.java:818) at org.eclipse.ui.internal.EditorManager$11.run(EditorManager.java:1090) at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:960) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:302) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jface.window.ApplicationWindow$1.run (ApplicationWindow.java:431) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.window.ApplicationWindow.run (ApplicationWindow.java:428) at org.eclipse.ui.internal.WorkbenchWindow.run (WorkbenchWindow.java:1332) at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation (EditorManager.java:966) at org.eclipse.ui.internal.EditorManager.savePart (EditorManager.java:1095) at org.eclipse.ui.internal.WorkbenchPage.savePart (WorkbenchPage.java:2351) at org.eclipse.ui.internal.WorkbenchPage.saveEditor (WorkbenchPage.java:2363) at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:57) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.ui.internal.WWinKeyBindingService.pressed (WWinKeyBindingService.java:214) at org.eclipse.ui.internal.WWinKeyBindingService$5.widgetSelected (WWinKeyBindingService.java:332) at org.eclipse.ui.internal.AcceleratorMenu$2.handleEvent (AcceleratorMenu.java:68) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2036) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1742) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1399) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1382) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583) Save Failed
Raising severity since dataloss is possible due to this bug (may loose unsaved changes)
Created attachment 5200 [details] Zipped editor contents This source corresponds to the class: org.eclipse.jdt.internal.compiler.parser.Parser
Actually, reassigning to JDT/Core for further analysis. Suspecting some side- effect related to new working copies management (was running patched JDT/Core).
If closing editor (discarding unsaved changes), then cannot open editor again since it complains it has the wrong type of shared working copy.
!ENTRY org.eclipse.jdt.ui 4 10002 Jun 16, 2003 16:10:21.933 !MESSAGE Shared working copy has wrong buffer !STACK 0 java.lang.ClassCastException at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createEle mentInfo(CompilationUnitDocumentProvider.java:852) at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect (AbstractDocumentProvider.java:306) at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput (AbstractTextEditor.java:2422) at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput (StatusTextEditor.java:162) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput (JavaEditor.java:1585) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput (CompilationUnitEditor.java:940) at org.eclipse.ui.texteditor.AbstractTextEditor$8.run (AbstractTextEditor.java:1906) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:302) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jface.window.ApplicationWindow$1.run (ApplicationWindow.java:431) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.window.ApplicationWindow.run (ApplicationWindow.java:428) at org.eclipse.ui.internal.WorkbenchWindow.run (WorkbenchWindow.java:1332) at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit (AbstractTextEditor.java:1921) at org.eclipse.ui.texteditor.AbstractTextEditor.init (AbstractTextEditor.java:1938) at org.eclipse.ui.internal.EditorManager.createSite (EditorManager.java:604) at org.eclipse.ui.internal.EditorManager.openInternalEditor (EditorManager.java:666) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor (EditorManager.java:459) at org.eclipse.ui.internal.EditorManager.openEditorFromInput (EditorManager.java:333) at org.eclipse.ui.internal.EditorManager.openEditor (EditorManager.java:424) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor (WorkbenchPage.java:2051) at org.eclipse.ui.internal.WorkbenchPage.access$6 (WorkbenchPage.java:1999) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:1986) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1981) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1882) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:133) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:111) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run (OpenTypeAction.java:67) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run (OpenTypeAction.java:80) at org.eclipse.ui.internal.PluginAction.runWithEvent (PluginAction.java:263) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent (WWinPluginAction.java:207) at org.eclipse.ui.internal.WWinKeyBindingService.pressed (WWinKeyBindingService.java:214) at org.eclipse.ui.internal.WWinKeyBindingService$5.widgetSelected (WWinKeyBindingService.java:332) at org.eclipse.ui.internal.AcceleratorMenu$2.handleEvent (AcceleratorMenu.java:68) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2036) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1742) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1399) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1382) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583)
Offending code is attempting to cast to 'DocumentAdapter'. Presumably, a bogus working copy got stuck in place of the shared one. Suspecting original unit took place of shared one.
Some tracing shown that it is related to buffer cache flushing. Underlying CU buffer got closed, and it seems to have interfered with wc buffer from thereon. Hard to reproduce though (need to get close to model cache flushing mode).
Workaround added to never flush working copies from the cache until they are destroyed (Compilation.hasUnsavedChanges() always returns true for working copies).
Things to clean: - remove negative useCount support - ensure no way to get a handle onto working copy with unit info. Info creation must use working copy for these type of handles. For primary ones, may need to remember which kind to use (owner's implementation?)
Problem reproduced by changing Openable cache size down to 10, and using self- hosted JDT/Core. Issue is caused by the fact the edited working copy is getting closed when opened since cache is full (and for the duration of the editor opening, the buffer hasn't been changed yet). Thus editor creates working copy, which gets closed immediately. However, since the working copy got closed, it inserted a fake info (negative use count) to remember its working copy nature (as handle is true unit). When some UI refresh is triggered, then the working copy is populated through one of its children (source method needs refresh, likely overriding indicator), and thus a new info is created from scratch (as fake info never made it to the cache, it only got added temporarily, but purged anyway). If working copies are to tolerated being closed halfway through, then their regular opening (through createElementInfo()) should be able to create the proper info kind. Never flushing them doesn't strike me as it is consistent with their buffer management (i.e. workaround looks good actually).
*** Bug 38969 has been marked as a duplicate of this bug. ***
I got the NPE again using the newest J Core stuff (downloaded the patch this morning from the JDT Core page). I had to close the editor but now I can no longer open the file: Shared Working Copy has wrong buffer.
This was in the .log: !ENTRY org.eclipse.jdt.ui 4 10002 Jun 17, 2003 10:44:56.275 !MESSAGE Shared working copy has wrong buffer !STACK 0 java.lang.ClassCastException at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createElementInfo(CompilationUnitDocumentProvider.java:852) at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:306) at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:2422) at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:162) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:1585) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:940) at org.eclipse.ui.texteditor.AbstractTextEditor$8.run(AbstractTextEditor.java:1906) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:302) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:431) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:428) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1332) at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:1921) at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:1938) at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:604) at org.eclipse.ui.internal.EditorManager.openInternalEditor(EditorManager.java:666) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:459) at org.eclipse.ui.internal.EditorManager.openEditorFromInput(EditorManager.java:333) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:424) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2051) at org.eclipse.ui.internal.WorkbenchPage.access$6(WorkbenchPage.java:1999) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:1986) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1981) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1882) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:133) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:111) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:67) at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:80) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:263) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:207) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:542) at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:496) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:443) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2036) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1742) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1399) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1382) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583)
What you are seeing is the behavior without the latest fix in. Closing/reopening the editor causes the secondary class cast issue (side- effect).
I have the newest (at least I have what Jerome asked me to verify). André used JDT Core HEAD which shows the same problem.
Note: it does not happen consistently. It worked but suddenly I could no longer save the file. Same for André. No repeatable steps yet.
Once it occurs, then nothing works any longer. The only remaining hole would be if someone did explicitly call #close() on a working copy (which doesn't happen in our code base). We will address this last issue, but it shouldn't be as critical as the implicit #close() occurring when cache is getting full. Current thinking is that working copies should remain open until they are discarded. Indeed, a closed working copy may have trouble issuing reconcile fine-grain deltas (was assumed always open at this stage). Need to investigate some more.
Got the problem as well (with the patch). Still don't know how to reproduce the problem.
We have now evidence it can still occur even with workaround. Escaladating. Will need to resubmit.
We suspect the remaining scenario is a concurrency issue around reconciliation. Reconciliation removes the info from the cache. If some other thread populates the working copy element during reconciliation, then it will not create a working copy element info.
*** Bug 39019 has been marked as a duplicate of this bug. ***
Moved useCount and problemRequestor to another separate table (a table of PerWorkingCopyInfos). Elements in this table are updated independantly from the info of the working copy. Also changed element cache to never close working copies until they are discarded. Finally, got rid of WorkingCopyElementInfo. A working copy info is now a CompilationUnitInfo.
Verified.