Bug 550336 - Staging view freezes on commit (NPE in AbstractTextEditor$TextEditorSavable.isDirty)
Summary: Staging view freezes on commit (NPE in AbstractTextEditor$TextEditorSavable.i...
Status: CLOSED DUPLICATE of bug 569286
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 4.13 RC2   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 550429 (view as bug list)
Depends on:
Blocks: 578408 550691
  Show dependency tree
 
Reported: 2019-08-22 09:45 EDT by Matthias Becker CLA
Modified: 2022-01-27 10:10 EST (History)
13 users (show)

See Also:


Attachments
Stacktrace of disabled staging view (29.23 KB, text/plain)
2019-08-27 11:42 EDT, Matthias Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Becker CLA 2019-08-22 09:45:09 EDT
Since Eclipse 2019-09 M2 I regularly (but not always) get a freeze in the staging view.

I stage some file. Press "Commit and Push" and then the complete staging view get's inactive (grey) so that once can no longer press buttons.

I can only recover by restarting the IDE. After the restart I see that the commit did not happen. The staging view has the same state as it was directly bevor I have pressed "Commit and Push".
Comment 1 Matthias Sohn CLA 2019-08-22 10:02:00 EDT
is your home directory on a network volume ?
Comment 2 Matthias Becker CLA 2019-08-22 10:04:39 EDT
(In reply to Matthias Sohn from comment #1)
> is your home directory on a network volume ?

No it's not.
Comment 3 Thomas Wolf CLA 2019-08-22 10:36:08 EDT
Let's wait until M3 comes out. I also set up a 2019-09 Eclipse and got strange things recently with EGit nightly. (Though nothing like comment 0.) Since I don't have any such problems with EGit nightly in 2019-06 or earlier instances I wrote it off to 2019-09 M2 being a development version. I'll check again once M3 is here.
Comment 4 Michael Keppler CLA 2019-08-25 04:55:25 EDT
I do all my development in about 10 different installations of M2 and never have seen that (but I use egit nightly).

When you write freeze, you do not mean the application is not responding anymore, but just that all controls in the view get disabled, right? That is normal behaviour with every commmit. I assume that some jgit operation then doesn't come back, and egit never re-enables the buttons.

Did you ever wait as long as Preferences > Team > Git > Conneciton timeout before restarting? Do you see anything in the error log view?
Comment 5 Matthias Sohn CLA 2019-08-25 05:13:22 EDT
Create a couple of thread dumps when it hangs, this should reveal what's going on.
Comment 6 Thomas Wolf CLA 2019-08-26 02:59:32 EDT
Any errors in the log? See also bug 550429.
Comment 7 Matthias Becker CLA 2019-08-26 03:34:17 EDT
(In reply to Thomas Wolf from comment #6)
> Any errors in the log? See also bug 550429.

The symptom sounds exactly what happens. I will look into the error log when it happens next time.
Comment 8 Matthias Becker CLA 2019-08-27 11:42:09 EDT
Created attachment 279689 [details]
Stacktrace of disabled staging view

This is the stacktrace.
The staging view stays inactive.
The application is still running (so the main thread is not blocked).
Comment 9 Thomas Wolf CLA 2019-08-27 15:26:04 EDT
(In reply to Matthias Becker from comment #8)
> Created attachment 279689 [details]
> Stacktrace of disabled staging view

Well, the stack trace just show a completely idle Eclipse. What about the error log?
Comment 10 Matthias Becker CLA 2019-08-28 03:58:30 EDT
(In reply to Thomas Wolf from comment #9)
> (In reply to Matthias Becker from comment #8)
> > Created attachment 279689 [details]
> > Stacktrace of disabled staging view
> 
> Well, the stack trace just show a completely idle Eclipse. What about the
> error log?

It says this:

java.lang.NullPointerException
	at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.isDirty(AbstractTextEditor.java:7186)
	at org.eclipse.ui.internal.Workbench.getFilteredSaveables(Workbench.java:3495)
	at org.eclipse.ui.internal.Workbench.saveAll(Workbench.java:3468)
	at org.eclipse.egit.ui.UIUtils.saveAllEditors(UIUtils.java:886)
	at org.eclipse.egit.ui.internal.staging.StagingView.commit(StagingView.java:4236)
	at org.eclipse.egit.ui.internal.staging.StagingView.access$28(StagingView.java:4218)
	at org.eclipse.egit.ui.internal.staging.StagingView$22.widgetSelected(StagingView.java:1167)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4383)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3787)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
Comment 11 Thomas Wolf CLA 2019-08-28 04:24:23 EDT
*** Bug 550429 has been marked as a duplicate of this bug. ***
Comment 12 Thomas Wolf CLA 2019-08-28 04:31:57 EDT
(In reply to Matthias Becker from comment #10)
> (In reply to Thomas Wolf from comment #9)
> > (In reply to Matthias Becker from comment #8)
> > > Created attachment 279689 [details]
> > > Stacktrace of disabled staging view
> > 
> > Well, the stack trace just show a completely idle Eclipse. What about the
> > error log?
> 
> It says this:
> 
> java.lang.NullPointerException
> 	at
> org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.
> isDirty(AbstractTextEditor.java:7186)
> 	at
> org.eclipse.ui.internal.Workbench.getFilteredSaveables(Workbench.java:3495)
> 	at org.eclipse.ui.internal.Workbench.saveAll(Workbench.java:3468)
> 	at org.eclipse.egit.ui.UIUtils.saveAllEditors(UIUtils.java:886)
> 	at
> org.eclipse.egit.ui.internal.staging.StagingView.commit(StagingView.java:
> 4236)

Was this error reported in the UI (via a dialog)?

What Java version? In bug 550429 it was Java 12.0.1, and also a 4.13 Eclipse.

Move this to platform? If AbstractTextEditor$TextEditorSavable.isDirty() throws NPEs something is utterly broken in the text editor framework.

Follow-up bug 550513 for EGit created, but note that that will only mask this problem.
Comment 13 Thomas Wolf CLA 2019-08-28 04:35:48 EDT
See also bug 237680. :-(
Comment 14 Thomas Wolf CLA 2019-08-28 04:40:43 EDT
And also bug 173250 and various bugs linked from there. Looks like something in 4.13 has unfixed that.
Comment 15 Thomas Wolf CLA 2019-08-28 04:42:32 EDT
Moving to Platform/UI.
Comment 16 Matthias Becker CLA 2019-08-28 05:18:46 EDT
This is a severy issue. I would say a showstopper for 4.13 and 2019-09
Comment 17 Dani Megert CLA 2019-08-28 05:27:10 EDT
(In reply to Matthias Becker from comment #16)
> This is a severy issue. I would say a showstopper for 4.13 and 2019-09
Can you provide exact steps to reproduce the NPE?
Comment 18 Matthias Becker CLA 2019-08-28 05:55:47 EDT
(In reply to Dani Megert from comment #17)
> (In reply to Matthias Becker from comment #16)
> > This is a severy issue. I would say a showstopper for 4.13 and 2019-09
> Can you provide exact steps to reproduce the NPE?

"Exact"? No

Just do Java Coding and every now and then you will get this.
Comment 19 Thomas Wolf CLA 2019-08-28 06:05:13 EDT
(In reply to Matthias Becker from comment #18)
> (In reply to Dani Megert from comment #17)
> > (In reply to Matthias Becker from comment #16)
> > > This is a severy issue. I would say a showstopper for 4.13 and 2019-09
> > Can you provide exact steps to reproduce the NPE?
> 
> "Exact"? No
> 
> Just do Java Coding and every now and then you will get this.

Presumably you also stage and commit some changes from time to time. Or can it also be reproduced by having dirty editors (maybe many tabs, so that there are hidden dirty editors) and then choosing "Close all" from the context menu?

And what Java version do you get this with? (In the duplicate bug 550429 the user reported Java 12.0.1.)

I don't see any 2019-09 M3 EPP packages yet, but... does this also occur with M3?
Comment 20 Matthias Becker CLA 2019-08-28 06:16:54 EDT
(In reply to Thomas Wolf from comment #19)
> Presumably you also stage and commit some changes from time to time. 
Yes.
>Or can
> it also be reproduced by having dirty editors (maybe many tabs, so that
> there are hidden dirty editors) and then choosing "Close all" from the
> context menu?
Never tried. As I don't get an Error dialog but only this error log entry I may not notice this NPE.
> 
> And what Java version do you get this with? (In the duplicate bug 550429 the
> user reported Java 12.0.1.)
It's Java 11.0.2 
 
> I don't see any 2019-09 M3 EPP packages yet, but... does this also occur
> with M3?
Don't know.
Comment 21 Dani Megert CLA 2019-08-28 08:06:00 EDT
(In reply to Matthias Becker from comment #18)
> (In reply to Dani Megert from comment #17)
> > (In reply to Matthias Becker from comment #16)
> > > This is a severy issue. I would say a showstopper for 4.13 and 2019-09
> > Can you provide exact steps to reproduce the NPE?
> 
> "Exact"? No
> 
> Just do Java Coding and every now and then you will get this.
Believe me I do a lot of that and have never seen this (including using EGit).
Comment 22 Paul Pazderski CLA 2019-08-28 08:22:58 EDT
I have seen this problem but cannot provide exact steps to reproduce nor say what exact 4.13 build had/started this problem.

I also tried to intentional trigger this error but failed.
Comment 23 Dani Megert CLA 2019-08-28 08:26:27 EDT
(In reply to Paul Pazderski from comment #22)
> I have seen this problem but cannot provide exact steps to reproduce nor say
> what exact 4.13 build had/started this problem.
Did you see this only in combination with Staging view?
Comment 24 Paul Pazderski CLA 2019-08-28 08:29:41 EDT
(In reply to Dani Megert from comment #23)
> (In reply to Paul Pazderski from comment #22)
> > I have seen this problem but cannot provide exact steps to reproduce nor say
> > what exact 4.13 build had/started this problem.
> Did you see this only in combination with Staging view?

Yes, same situation as described in the initial description with the minor difference that I used "Commit" instead of "Commit and Push"
Comment 25 Dani Megert CLA 2019-08-28 09:04:01 EDT
(In reply to Paul Pazderski from comment #24)
> (In reply to Dani Megert from comment #23)
> > (In reply to Paul Pazderski from comment #22)
> > > I have seen this problem but cannot provide exact steps to reproduce nor say
> > > what exact 4.13 build had/started this problem.
> > Did you see this only in combination with Staging view?
> 
> Yes, same situation as described in the initial description with the minor
> difference that I used "Commit" instead of "Commit and Push"
OK, so, could also be caused by new version of EGit instead of new version of Eclipse?
Comment 26 Paul Pazderski CLA 2019-08-28 09:14:35 EDT
(In reply to Dani Megert from comment #25)
> (In reply to Paul Pazderski from comment #24)
> > (In reply to Dani Megert from comment #23)
> > > (In reply to Paul Pazderski from comment #22)
> > > > I have seen this problem but cannot provide exact steps to reproduce nor say
> > > > what exact 4.13 build had/started this problem.
> > > Did you see this only in combination with Staging view?
> > 
> > Yes, same situation as described in the initial description with the minor
> > difference that I used "Commit" instead of "Commit and Push"
> OK, so, could also be caused by new version of EGit instead of new version
> of Eclipse?

Not sure about that. My used Egit version is 5.4.0.201906121030-r.
Comment 27 Thomas Wolf CLA 2019-08-28 10:18:05 EDT
(In reply to Dani Megert from comment #25)
> (In reply to Paul Pazderski from comment #24)
> > (In reply to Dani Megert from comment #23)
> > > (In reply to Paul Pazderski from comment #22)
> > > > I have seen this problem but cannot provide exact steps to reproduce nor say
> > > > what exact 4.13 build had/started this problem.
> > > Did you see this only in combination with Staging view?
> > 
> > Yes, same situation as described in the initial description with the minor
> > difference that I used "Commit" instead of "Commit and Push"
> OK, so, could also be caused by new version of EGit instead of new version
> of Eclipse?

Highly unlikely; there've been no changes to the relevant code in EGit as far as I see. It also doesn't occur in a git-related operation; it occurs when EGit tries to save all open editors before a commit. (If any are saved, it'll then ask the user whether he wants to include those changes in the commit.)

In any case, EGit calls IWorkbench.saveAll() and then one of the editors throws that NPE. Hardly the staging view's fault, isn't it?

Also, in bug 237680 somebody reported this in 2015 with a stack trace that shows no trace of EGit or of any other team provider.

Were there any changes to the handling of the Saveables in platform lately?
Comment 28 Dani Megert CLA 2019-08-28 10:20:00 EDT
Kalyan, please have a look.
Comment 29 Kalyan Prasad Tatavarthi CLA 2019-08-29 03:12:58 EDT
(In reply to Dani Megert from comment #28)
> Kalyan, please have a look.

I have not been able to reproduce this issue. I am using Java 11.0.2 with Egit 5.4.0.201906121030-r on Windows 10. 

From the stack trace it appears that Matthias is facing this issue on Mac. @Paul Are you also facing this issue on Mac?
Comment 30 Robert Lichtenberger CLA 2019-08-29 03:17:15 EDT
FYI: I have reported the same problem in Bug 550429, running eclipse in Java 12 under Linux, it is thus unlikely that it is a Mac-only problem.
Comment 31 Paul Pazderski CLA 2019-08-29 03:22:31 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #29)
> @Paul Are you also facing this issue on Mac?

No. Windows 7 or 10, not sure on which one it actually happened maybe both.
Comment 32 Kalyan Prasad Tatavarthi CLA 2019-08-29 03:42:02 EDT
The only way AbstractTextEditor$TextEditorSavable.isDirty() call can cause an NPE is if AbstractTextEditor$TextEditorSavable.disconnectEditor() call has occurred before this call and therefore the TextEditor associated with  the saveable is null. 

As a last resort we can add a null pointer check in the isDirty() call (Because the associated TextEditor is disconnected, its safe to return isDirty as false by this saveable.)

Also, 4.13 M3 will be available tomorrow. you can try using this and provide your feedback.

I will create a NPE check gerrit patch and deliver the changes as part of 4.13 RC2 on 3rd September based on your feedback of using 4.13 M3 if that is ok with everyone.
Comment 33 Matthias Becker CLA 2019-08-29 09:00:03 EDT
I can reproduce it without egit.
I "think" my IDE is 1909 M2 of SimRel.
Where can I finde a "M2"-Version of Platform?

I get the NPE also when closing a project while a editor is open for a file inside this project.

The good news is with M3 from:
https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/S-4.13M3-201908211800/eclipse-SDK-4.13M3-macosx-cocoa-x86_64.dmg&mirror_id=1039

this does not happen.

With M1 from:
https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/S-4.13M1-201907111805/eclipse-SDK-4.13M1-macosx-cocoa-x86_64.dmg&mirror_id=1039

it also does not happen.

So it seems to be fixed in M3.
Comment 34 Lars Vogel CLA 2019-08-29 10:57:49 EDT
(In reply to Matthias Becker from comment #33)
> Where can I finde a "M2"-Version of Platform?

For M2 we contribute only an I-Build. See Bug 546902. I would not spend time testing in M2, testing with M3 is more important.
Comment 35 Matthias Becker CLA 2019-08-29 10:59:31 EDT
(In reply to Lars Vogel from comment #34)
> For M2 we contribute only an I-Build. See Bug 546902.

Btw.: Why is this? Why do we only contribute an I-Build?
Comment 36 Lars Vogel CLA 2019-08-29 11:25:56 EDT
(In reply to Matthias Becker from comment #35)
> Btw.: Why is this? Why do we only contribute an I-Build?

IIRC we decided that two tested M-builds are sufficient for a 3 months release cycle.
Comment 37 Paul Pazderski CLA 2019-09-02 10:26:18 EDT
(In reply to Matthias Becker from comment #33)
> So it seems to be fixed in M3.

No. Just happened again in I20190901-1800 and EGit 5.5.0.201908280940-m3.
Comment 38 Thomas Wolf CLA 2019-09-02 10:55:22 EDT
(In reply to Paul Pazderski from comment #37)
> (In reply to Matthias Becker from comment #33)
> > So it seems to be fixed in M3.
> 
> No. Just happened again in I20190901-1800 and EGit 5.5.0.201908280940-m3.

In the next EGit 5.5.0 version (I guess that'll be -rc1; otherwise in our final release version -r) you'll get an error dialog for this and the staging view will re-enable.

(In reply to Kalyan Prasad Tatavarthi from comment #32)
> 
> As a last resort we can add a null pointer check in the isDirty() call

That would just completely hide the problem. Perhaps the right thing to do for the 4.13 release if the root cause cannot be determined, but maybe one could remove such a null check early in 4.14 again with the intent of tracking this down for good in 4.14.
Comment 39 Eclipse Genie CLA 2019-09-03 02:24:28 EDT
New Gerrit change created: https://git.eclipse.org/r/148745
Comment 40 Kalyan Prasad Tatavarthi CLA 2019-09-03 02:27:07 EDT
(In reply to Eclipse Genie from comment #39)
> New Gerrit change created: https://git.eclipse.org/r/148745

Abandoning this gerrit patch
Comment 41 Kalyan Prasad Tatavarthi CLA 2019-09-03 02:34:22 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #40)
> (In reply to Eclipse Genie from comment #39)
> > New Gerrit change created: https://git.eclipse.org/r/148745
> 
> Abandoning this gerrit patch

New Gerrit change created: https://git.eclipse.org/r/#/c/148746/

This change catches the NPE in AbstractTextEditor$TextEditorSavable.isDirty and logs it.
Comment 43 Kalyan Prasad Tatavarthi CLA 2019-09-03 04:17:18 EDT
(In reply to Eclipse Genie from comment #42)
> Gerrit change https://git.eclipse.org/r/148746 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/
> ?id=20f86e123c7e6fa0950be7a8f87a1a61f2650395

Moving this bug to 4.14 to check for the exact reason for the NPE.
Comment 44 Lakshmi P Shanmugam CLA 2019-09-03 04:21:43 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #43)
> (In reply to Eclipse Genie from comment #42)
> > Gerrit change https://git.eclipse.org/r/148746 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/
> > ?id=20f86e123c7e6fa0950be7a8f87a1a61f2650395
> 
> Moving this bug to 4.14 to check for the exact reason for the NPE.

May be we should close this bug to track the 4.13 RC2 change and clone this bug for 4.14.
Comment 45 Kalyan Prasad Tatavarthi CLA 2019-09-03 08:09:34 EDT
(In reply to Lakshmi Shanmugam from comment #44)
> (In reply to Kalyan Prasad Tatavarthi from comment #43)
> > (In reply to Eclipse Genie from comment #42)
> > > Gerrit change https://git.eclipse.org/r/148746 was merged to [master].
> > > Commit:
> > > http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/
> > > ?id=20f86e123c7e6fa0950be7a8f87a1a61f2650395
> > 
> > Moving this bug to 4.14 to check for the exact reason for the NPE.
> 
> May be we should close this bug to track the 4.13 RC2 change and clone this
> bug for 4.14.

Cloned a bug 550691 for 4.14 M1 and resolving this bug as fixed in 4.13 RC2 to track the changes.
Comment 46 Kalyan Prasad Tatavarthi CLA 2019-09-03 08:16:51 EDT
@Paul Can you please verify this fix in tonight's build, tomorrow for 4.13 RC2?
Comment 47 Paul Pazderski CLA 2019-09-03 11:20:00 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #46)
> @Paul Can you please verify this fix in tonight's build, tomorrow for 4.13
> RC2?

No. I have still no clue what triggers this bug and the last time I tried to reproduce it everything worked fine. But I will anyway use this build soon and can tell if the new error message pop up in log.
Comment 48 Vikas Chandra CLA 2020-11-30 23:25:28 EST
Still happens on latest I build. See bug 569286.
Comment 49 Christoph Laeubrich CLA 2021-02-12 01:09:16 EST
Maybe the reason for this is that

> org.eclipse.ui.texteditor.AbstractTextEditor.dispose()

does not inform the listener about the close/dispose in contrast to 

> org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(IEditorInput)

May this happens magically somewhere in between but if not the savable remains in the SaveablesList and Workbench.saveAll will try to call the (invalid) savable... can someone verify this observation?
Comment 50 Kalyan Prasad Tatavarthi CLA 2021-02-15 05:36:40 EST Comment hidden (obsolete)
Comment 51 Kalyan Prasad Tatavarthi CLA 2021-02-15 05:38:00 EST
Resolved this bug by mistake. So, Reopening
Comment 52 Andrey Loskutov CLA 2021-06-28 09:00:35 EDT

*** This bug has been marked as a duplicate of bug 569286 ***