Bug 535741 - [HiDPI] Dozens of NPEs in LogView.onMouseMove
Summary: [HiDPI] Dozens of NPEs in LogView.onMouseMove
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: 4.12 RC1   Edit
Assignee: Sravan Kumar Lakkimsetti CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
: 544897 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-06-09 11:30 EDT by Andreas Sewe CLA
Modified: 2019-05-30 06:38 EDT (History)
10 users (show)

See Also:
akurtakov: review+
ericwill: review+


Attachments
Screenshot illustrating the situation (184.89 KB, image/png)
2018-06-21 14:59 EDT, Andreas Sewe CLA
no flags Details
About Information (722.97 KB, text/plain)
2018-08-21 03:59 EDT, Christian Dietrich CLA
no flags Details
Screenshot (36.44 KB, image/png)
2018-08-21 10:06 EDT, Christian Dietrich CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2018-06-09 11:30:12 EDT
Noticed this testing the Photon RC3 Java EPP package under Ubuntu 8.4 on Wayland:

I have dozens of NPEs logged in the Error Log, all looking like this:

java.lang.NullPointerException
	at org.eclipse.ui.internal.views.log.LogView.onMouseMove(LogView.java:1417)
	at org.eclipse.ui.internal.views.log.LogView.lambda$9(LogView.java:1273)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.views.log.EventDetailsDialog.open(EventDetailsDialog.java:188)
	at org.eclipse.ui.internal.views.log.EventDetailsDialogAction.run(EventDetailsDialogAction.java:99)
	at org.eclipse.ui.internal.views.log.LogView.lambda$2(LogView.java:562)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:830)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:827)
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1512)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1257)
	at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:249)
	at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:247)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:306)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1471)

I can't give you much more detail, I am afraid. The only thing I remember doing was signing into Eclipse User Storage > Open My Account.
Comment 1 Andrey Loskutov CLA 2018-06-09 13:54:52 EDT
Moving to SWT. The image is probably null, may be due Wayland.
Comment 2 Eric Williams CLA 2018-06-11 13:04:45 EDT
Does this happen only on Wayland? What about X11?
Comment 3 Andreas Sewe CLA 2018-06-21 13:35:56 EDT
(In reply to Eric Williams from comment #2)
> Does this happen only on Wayland? What about X11?

I just got this in X11 ("Ubuntu" in the Ubunut 18.04 gdm menu) with Photon RC4. Will try to retrace my steps and provide you with steps to reproduce.
Comment 4 Eric Williams CLA 2018-06-21 14:18:05 EDT
(In reply to Andreas Sewe from comment #3)
> (In reply to Eric Williams from comment #2)
> > Does this happen only on Wayland? What about X11?
> 
> I just got this in X11 ("Ubuntu" in the Ubunut 18.04 gdm menu) with Photon
> RC4. Will try to retrace my steps and provide you with steps to reproduce.

Okay, please keep us updated!
Comment 5 Andreas Sewe CLA 2018-06-21 14:59:59 EDT
Created attachment 274577 [details]
Screenshot illustrating the situation

(In reply to Eric Williams from comment #4)
> (In reply to Andreas Sewe from comment #3)
> > (In reply to Eric Williams from comment #2)
> > > Does this happen only on Wayland? What about X11?
> > 
> > I just got this in X11 ("Ubuntu" in the Ubunut 18.04 gdm menu) with Photon
> > RC4. Will try to retrace my steps and provide you with steps to reproduce.
> 
> Okay, please keep us updated!

OK, I've just reproduced this in a very simple scenario.

- Now I am on Wayland again, but I don't think it matters (comment 3).
- Open a fresh workspace
- Dismiss the Welcome view by clicking on "Workbench"
- Un-maximize the Eclipse window.
- Search for "Err" in the Quick Access widget and open the "Error Log".
- Move the mouse over the Error Log view that just opened

This spams the view with lots of NPEs (see the screenshot).

The only thing that seems crucial is that the mouse hovers over an existing Error Log entry. In my case (Eclipse IDE for Java Developers Photon RC4 from [1]), it is initially the "Builtin LFS support not present/detected" warning by EGit (Bug 535954). Thereafter, once the first NPE shows up, there is always another log entry under the mouse cursor...

[1] <https://ci.eclipse.org/packaging/job/photon.epp-tycho-build/345/artifact/org.eclipse.epp.packages/archive/>
Comment 6 Eric Williams CLA 2018-06-21 16:31:07 EDT
(In reply to Andreas Sewe from comment #5)
> OK, I've just reproduced this in a very simple scenario.
> 
> - Now I am on Wayland again, but I don't think it matters (comment 3).
> - Open a fresh workspace
> - Dismiss the Welcome view by clicking on "Workbench"
> - Un-maximize the Eclipse window.
> - Search for "Err" in the Quick Access widget and open the "Error Log".
> - Move the mouse over the Error Log view that just opened
> 
> This spams the view with lots of NPEs (see the screenshot).
> 
> The only thing that seems crucial is that the mouse hovers over an existing
> Error Log entry. In my case (Eclipse IDE for Java Developers Photon RC4 from
> [1]), it is initially the "Builtin LFS support not present/detected" warning
> by EGit (Bug 535954). Thereafter, once the first NPE shows up, there is
> always another log entry under the mouse cursor...
> 
> [1]
> <https://ci.eclipse.org/packaging/job/photon.epp-tycho-build/345/artifact/
> org.eclipse.epp.packages/archive/>

I can't reproduce this issue on my Fedora box. What themes (Eclipse and GTK3/system) are you using?
Comment 7 Christian Dietrich CLA 2018-08-21 03:59:49 EDT
Created attachment 275461 [details]
About Information

I am affected as well. I am on Linux Mint 19 Cinnamon.

please find my about dialog attached. if you need more information please give me details what exactly you need.
Comment 8 Christian Dietrich CLA 2018-08-21 04:19:34 EDT
Image _getImage (int index) {
	int count = Math.max (1, parent.getColumnCount ());
	if (0 > index || index > count - 1) return null;
	long /*int*/ [] ptr = new long /*int*/ [1];
	int modelIndex = parent.columnCount == 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex;
	GTK.gtk_tree_model_get (parent.modelHandle, handle, modelIndex + Tree.CELL_PIXBUF, ptr, -1);
	if (ptr [0] == 0) return null;
	ImageList imageList = parent.imageList;
	int imageIndex = imageList.indexOf (ptr [0]);
	OS.g_object_unref (ptr [0]);
	if (imageIndex == -1) return null;
	return imageList.get (imageIndex);
}

imageIndex is -1 so null is returned.
the imageList contains one image at index zero: platform:/plugin/org.eclipse.ui.views.log/icons/obj16/error_stack.png
Comment 9 Christian Dietrich CLA 2018-08-21 04:25:33 EDT
the imagelist contains a different id than the one we query for

public int indexOf (long /*int*/ pixbuf) {
	if (pixbuf == 0) return -1;
	for (int index=0; index<images.length; index++) {
		if (pixbuf == pixbufs [index]) return index;
	}
	return -1;
}
Comment 10 Christian Dietrich CLA 2018-08-21 04:33:07 EDT
setting GDK_BACKEND=x11 does not help
setting SWT_GTK3=0 does
Comment 12 Christian Dietrich CLA 2018-08-21 04:43:23 EDT
i dont use wayland at all

dietrich@dietrich-zbook:~/eclipse-workspace/org.eclipse.xtext.example.domainmodel.releng$ loginctl
   SESSION        UID USER             SEAT             TTY             
        c2       1000 dietrich         seat0                            

1 sessions listed.
dietrich@dietrich-zbook:~/eclipse-workspace/org.eclipse.xtext.example.domainmodel.releng$ loginctl show-session 2 -p Type   
Failed to get session path: No session '2' known
dietrich@dietrich-zbook:~/eclipse-workspace/org.eclipse.xtext.example.domainmodel.releng$ loginctl show-session c2 -p Type   
Type=x11
dietrich@dietrich-zbook:~/eclipse-workspace/org.eclipse.xtext.example.domainmodel.releng$ 

=> seems more like a general gtk3 problem
Comment 13 Eric Williams CLA 2018-08-21 09:52:09 EDT
(In reply to Christian Dietrich from comment #12)
> => seems more like a general gtk3 problem

Can you try with the Adwaita theme?
Comment 14 Christian Dietrich CLA 2018-08-21 09:54:20 EDT
what do i exactly need to set in environment to change the theme. how can i check if i have that theme installed?
Comment 15 Eric Williams CLA 2018-08-21 09:55:52 EDT
(In reply to Christian Dietrich from comment #14)
> what do i exactly need to set in environment to change the theme. how can i
> check if i have that theme installed?

Nothing Eclipse specific: close Eclipse, set your system theme to Adwaita, and re-launch Eclipse. You shouldn't have to install anything as it is the default theme shipped with GTK3.
Comment 16 Christian Dietrich CLA 2018-08-21 10:06:56 EDT
Created attachment 275469 [details]
Screenshot

well how do i change the system theme
Comment 17 Eric Williams CLA 2018-08-21 10:15:56 EDT
(In reply to Christian Dietrich from comment #16)
> Created attachment 275469 [details]
> Screenshot
> 
> well how do i change the system theme

Aha, you might have to install gnome-themes-standard. See: https://ubuntu-mate.community/t/how-to-fix-adwaita-theme/9039
Comment 18 Christian Dietrich CLA 2018-08-21 10:22:11 EDT
managed to change the theme:

org.eclipse.swt.internal.gdk.backend=x11
org.eclipse.swt.internal.gtk.theme=Adwaita

no change in behaviour
Comment 19 Eric Williams CLA 2018-08-21 10:28:21 EDT
(In reply to Christian Dietrich from comment #18)
> managed to change the theme:
> 
> org.eclipse.swt.internal.gdk.backend=x11
> org.eclipse.swt.internal.gtk.theme=Adwaita
> 
> no change in behaviour

What if you use GNOME? I am wondering if this is a DE specific issue.
Comment 20 Christian Dietrich CLA 2018-08-21 11:00:35 EDT
well ill try to setup a ubuntu vm and see
Comment 21 Christian Dietrich CLA 2018-08-21 11:14:48 EDT
@aloskutov. could not reproduce in ubuntu/vm, but i think i have found the issue: HiDPI

org.eclipse.swt.internal.deviceZoom=200
Comment 22 Christian Dietrich CLA 2018-08-21 11:15:19 EDT
if i use native resolution i can hardly see anything but dont get the errors
Comment 23 Christian Dietrich CLA 2018-08-21 11:20:07 EDT
Crosschecked with my ubuntu-gnome vm
if i use 200% for hidpi there then the problem occurrs there too
Comment 24 Eric Williams CLA 2018-08-21 11:43:52 EDT
(In reply to Christian Dietrich from comment #23)
> Crosschecked with my ubuntu-gnome vm
> if i use 200% for hidpi there then the problem occurrs there too

Adding Sravan to CC as he has been working on the HiDPI stuff.
Comment 25 Raymond Auge CLA 2019-02-04 11:46:54 EST
Just for reference I get this on Ubuntu 18.10, using Gnome 3.30.1, with zoom at %200, Eclipse 2018-12 (I20181206-0815)
Comment 26 Andrey Loskutov CLA 2019-02-27 16:21:03 EST
*** Bug 544897 has been marked as a duplicate of this bug. ***
Comment 27 Stephen Montgomery CLA 2019-03-22 07:00:56 EDT
For the love of God please fix this. I've just realized this issue was causing my workspace/maven building so slowly. I'm on Cinnamon 19.1 with HiDPI (200%) set. I'm since downgraded to STS 3.9.4.RELEASE (based on 4.7.3a) and the error and performance issues have gone away. Not as pretty though.
Comment 28 Dimitry CLA 2019-05-03 05:56:08 EDT
Also happens on Ubuntu Mate 18.04 LTS HiDPI 200%
Comment 29 Lakshmi P Shanmugam CLA 2019-05-13 05:32:17 EDT
Sravan, can you please take a look?
Comment 30 Sravan Kumar Lakkimsetti CLA 2019-05-14 04:20:18 EDT
Started working on it. I am able to identify problem and fix in most cases. but there are still some use cases where the image returned is null. 

The root cause is in hidpi mode we had to scale the image as the gtk_tree_store uses pixbuf instead of cairo surface. auto scale works only on cairo surface. The problem is after resizing the pixbuf we are supposed to replace old pixbuf with new one in the imagelist. This did not happen. This is causing getImage to return null in most cases and causing this problem.
Comment 31 Eclipse Genie CLA 2019-05-27 01:39:17 EDT
New Gerrit change created: https://git.eclipse.org/r/142838
Comment 32 Sravan Kumar Lakkimsetti CLA 2019-05-27 02:15:22 EDT
(In reply to Eclipse Genie from comment #31)
> New Gerrit change created: https://git.eclipse.org/r/142838

While updating the Image for table and tree items we resize the image as the image specified is in pixbuf instead of cairo surface. Due to this resize when we try to retrieve the image using the pixbuf stored in the imagelist it returns null. since the gtk store has resized pixbuf and imagelist has a different pixbuf. 

The solution is to update pixbuf array with new pixbuf and do the resize only if the image is added in the current setImage call. Otherwise we are resizing the pixbuf always (not desirable and not necessary)

Tested the use case mentioned in the bug and ran full test suite at 200% and ran Manual Junit tests for tree and table
Comment 33 Sravan Kumar Lakkimsetti CLA 2019-05-27 05:23:25 EDT
@eric,

Can you please test this patch?

you need to have some errors in the rror log to reproduce this issue. The npe is due to null returned for the error log entry's image.
Comment 35 Eric Williams CLA 2019-05-27 11:27:47 EDT
(In reply to Eclipse Genie from comment #34)
> Gerrit change https://git.eclipse.org/r/142838 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=415f94a4ceca8db4fae42b7020da3426dd8eca5a

In master now, thanks for the fix Sravan.
Comment 36 Sravan Kumar Lakkimsetti CLA 2019-05-28 02:55:36 EDT
Verified on Ubuntu 18.04 with 200% display using
Eclipse SDK
Version: 2019-06 (4.12)
Build id: I20190527-1805
OS: Linux, v.4.15.0-50-generic, x86_64 / gtk 3.22.30
Java version: 11.0.2
Comment 37 Stephen Montgomery CLA 2019-05-30 06:38:13 EDT
+1 on this. Downloaded today and maven performance gone from 10's minutes to seconds. Had to use Intellij for the last 6 months. Linux Mint 19.1 + HIDIP 200% + 4k monitor. Thanks!