Bug 560525 - "Save All" fails with NullPointerException and AssertionFailedException, locks up and cannot recover
Summary: "Save All" fails with NullPointerException and AssertionFailedException, lock...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
: 562812 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-02-25 14:41 EST by J. Zufallig CLA
Modified: 2020-05-05 04:54 EDT (History)
3 users (show)

See Also:


Attachments
Error log with stack dumps (90.49 KB, text/plain)
2020-02-25 14:41 EST, J. Zufallig CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description J. Zufallig CLA 2020-02-25 14:41:59 EST
Created attachment 281930 [details]
Error log with stack dumps

Clicking Save All pops out an unhelpful error dialog.  The entire content is

    Save All Failed
    assertion failed:

and no further text after the colon.  Clicking on the Details button shows

    Save All Failed
      assertion failed:

i.e., same text but with an indentation.  The file remains *unsaved*, and trying again immediately fails again.  Trying to quit the entire IDE offers to save the unsaved file, but also fails.  Our only options are to copy and paste the entire file's text somewhere else, or exit without saving and lose the work.

I've tried turning off every optional editor feature I can find, to no avail.  I don't know *which* editor feature is presumably causing this, so I don't know what to try next.

There are several exception dumps in the attached logfile.  I've put abbreviated useful bits here for the search engine's sake.  The uppermost is

!MESSAGE Save Failed
!STACK 0
org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:113)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:99)
	at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.updateMarkers(AbstractMarkerAnnotationModel.java:618)
	at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.commit(AbstractMarkerAnnotationModel.java:702)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.commitFileBufferContent(ResourceTextFileBuffer.java:366)
	at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.commit(ResourceFileBuffer.java:317)
	at org.eclipse.jdt.internal.ui.javaeditor.DocumentAdapter.save(DocumentAdapter.java:516)
	at org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.executeOperation(CommitWorkingCopyOperation.java:127)


followed by

!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.texteditor.SelectMarkerRulerAction.includesRulerLine(SelectMarkerRulerAction.java:293)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSelectAnnotationRulerAction.findJavaAnnotation(JavaSelectAnnotationRulerAction.java:160)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSelectAnnotationRulerAction.update(JavaSelectAnnotationRulerAction.java:111)
	at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.update(AbstractRulerActionDelegate.java:130)
	at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.setActiveEditor(AbstractRulerActionDelegate.java:90)
	at org.eclipse.ui.internal.EditorPluginAction.editorChanged(EditorPluginAction.java:69)
	at org.eclipse.ui.internal.EditorActionBuilder$EditorContribution.editorChanged(EditorActionBuilder.java:78)
	at org.eclipse.ui.internal.EditorActionBuilder$ExternalContributor.setActiveEditor(EditorActionBuilder.java:124)
	at org.eclipse.ui.internal.EditorActionBars.partChanged(EditorActionBars.java:338)
	at org.eclipse.ui.internal.WorkbenchPage.updateActivations(WorkbenchPage.java:326)


followed by

!MESSAGE An exception occurred while notifying part listeners
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.texteditor.SelectMarkerRulerAction.includesRulerLine(SelectMarkerRulerAction.java:293)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSelectAnnotationRulerAction.findJavaAnnotation(JavaSelectAnnotationRulerAction.java:160)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSelectAnnotationRulerAction.update(JavaSelectAnnotationRulerAction.java:111)
	at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.update(AbstractRulerActionDelegate.java:130)
	at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.setActiveEditor(AbstractRulerActionDelegate.java:90)
	at org.eclipse.ui.internal.EditorPluginAction.editorChanged(EditorPluginAction.java:69)


Following that are several NullPointerException with "!MESSAGE Unhandled event loop exception".
Comment 1 J. Zufallig CLA 2020-02-25 14:48:17 EST
FWIW, this is not the same as Bug 34658 (the only bug with a similar error that bugzilla could find before timing out).  We don't use the same components and that bug was apparently unique to a different platform.
Comment 2 Andrey Loskutov CLA 2020-02-25 14:48:27 EST
Steps to reproduce, or at least steps that caused this error?
Comment 3 J. Zufallig CLA 2020-02-26 15:22:57 EST
I edit Java source and click Save All.  Sometimes it works, and occasionally it completely locks up with the stack traces that I've uploaded.  That's all I'm doing, and each time I click Save All is no different from any of the others.  Why is it failing only intermittently?  I have no idea.

Once it fails, it never recovers; the entire IDE has to be killed and restarted.

What's doing it?  I have no idea, because the error message is worthless.

How did it get there?  The stack traces make no sense to me, that's why I uploaded them.

I have turned off all Save Actions except for removing trailing whitespace at the end of each line.  Maybe that's doing it, but why it would not fail consistently is beyond me because "loop over lines and remove space" is trivially easy to implement.  Presumably there's something else beyond the Save Actions going on behind the scenes, but it's certainly not mentioned in the Save Actions on-screen documentation.

The worst part is that it fails at actually writing anything to the disk, and never ever recovers, so whatever we've typed is lost unless we copy it to the clipboard and paste it into another editor.
Comment 4 Ed Willink CLA 2020-02-27 01:09:53 EST
You may see from Bug 558776 that my problems seemed to correlate with defective contents in auto-generated projects many of which had been closed, but which various tools do not completely ignore. I recommend looking to the rest of your workspace for inspiration as to what might be upsetting Eclipse.
Comment 5 J. Zufallig CLA 2020-03-02 10:09:20 EST
Those are definitely interesting problems, and I could easily imagine how they can be related somewhere under the surface.  However, I don't think they'd be related here:

1)  The only other project in the workspace is an instrumentation agent.  The project is "closed" and the source has always compiled cleanly.

2)  We don't use Compare windows.  Or the built-in Git, or any of the other tools.  All such things are handled outside of the IDE, and outside of Eclipse's awareness.


We would have been okay if something (a potential Save Action or similar) had failed, and the "unprocessed" file had been saved instead.  Or if the file had been saved to a temporary file as a backup before spitting out an error; that's what other editors have been doing for literal decades.  The fact that the text editor's Save button fails to write *anything* to disk -- YOU HAD ONE JOB -- and then the entire thing goes into a permanent failure state, is freakishly bizarre to me.
Comment 6 J. Zufallig CLA 2020-03-09 16:00:57 EDT
Happened again today to a coworker, this time with a stack trace that matched Bug 474080.

They were not happy about being prohibited from saving their work.  They're installing IntelliJ as I type this.
Comment 7 Noopur Gupta CLA 2020-05-05 04:48:22 EDT
*** Bug 562812 has been marked as a duplicate of this bug. ***
Comment 8 Andrey Loskutov CLA 2020-05-05 04:54:02 EDT
(In reply to J. Zufallig from comment #6)
> Happened again today

Are you using "Split editor" feature?