Bug 510772 - [HiDPI] Oxygen crashes at startup for zoom level greater than 200% (4k screen)
Summary: [HiDPI] Oxygen crashes at startup for zoom level greater than 200% (4k screen)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.7 M5   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 507103
Blocks: 511188
  Show dependency tree
 
Reported: 2017-01-20 10:57 EST by Cedric Dumoulin CLA
Modified: 2017-02-08 14:59 EST (History)
4 users (show)

See Also:


Attachments
The error log after the crash (2.69 KB, text/plain)
2017-01-20 10:57 EST, Cedric Dumoulin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Dumoulin CLA 2017-01-20 10:57:15 EST
Created attachment 266380 [details]
The error log after the crash

Oxygen crash at startup with a NullPointerException.

This happen on a PC with windows 10 and a 4K screen.

How to reproduce :
 - use a PC with W10 and a 4k screen (3840x2160)
 - install an oxygen distribution
 - double click on eclipse.exe
 - the splash screen appear
 - then a popup appear indicating that an error is logged.

The error log is joined to this bug.

I have tried several distribution of Oxygen (modeling, commiters, java), and all fail with the same error.

The same distributions work on another PC (running window 7 and HD screen).

The line :
"at org.eclipse.swt.internal.DPIUtil.validateAndGetImagePathAtZoom(DPIUtil.java:407)"

let me thing that the problem is linked to the HiRes screen.
Comment 1 Niraj Modi CLA 2017-01-23 05:52:01 EST
(In reply to Cedric Dumoulin from comment #0)
> The line :
> "at
> org.eclipse.swt.internal.DPIUtil.validateAndGetImagePathAtZoom(DPIUtil.java:
> 407)"
NullPointerException at above line suggests that there is some problem in ImageFileNameProvider implementation, which most likely be Platfrom-UI side.
Comment 2 Cedric Dumoulin CLA 2017-01-23 08:51:43 EST
After some investigations, I found that the crash happens when the windows screen scale is set >300%.
This scale can be changed in windows settings :
Windows Settings -> display -> Change the size of text, apps and other items

Oxygen starts correctly when scale is <=250%

The following method seem to be a good entry point to understand the problem :
org.eclipse.jface.resource.URLImageDescriptor.URLImageDataProvider.getImageData(int)

		public ImageData getImageData(int zoom) {
			URL tempURL = getURL(url);
			if (tempURL != null) {
				URL xUrl = getxURL(tempURL, zoom);
				return URLImageDescriptor.getImageData(xUrl);
			}
			return null;
		}

Here are the value of zoom for different screen scales :
scale  | zoom value | start ?
-------+------------+-----+
 150   | 100        | ok  |
-------+------------+-----+
 225   | 200        | ok  |
-------+------------+-----+
 250   | 200        | ok  |
-------+------------+-----+
 300   | 300        |crash|
---------------------------

When zoom is set to 300, URL xUrl = getxURL(tempURL, zoom) return null.
But the null value is not checked, and so URLImageDescriptor.getImageData(xUrl) throw a nullPointerException.

I have tried to return null when xURL is null. In this case, Oxygen start, but I have noted that some icons are now missing in view toolbars. This is also the case for neon.2 !!
Comment 3 Niraj Modi CLA 2017-01-24 04:47:18 EST
(In reply to Cedric Dumoulin from comment #2)
> After some investigations, I found that the crash happens when the windows
> screen scale is set >300%.
> This scale can be changed in windows settings :
> Windows Settings -> display -> Change the size of text, apps and other items
> 
> Oxygen starts correctly when scale is <=250%
IIRC, Eclipse doesn't ship images at 300% resolution. We only ship 100% & 200% zoom images, that's why you seeing the problem at 300% zoom level.

Workaround:
You can explicitly specify the zoom level(limit it to 200%) by adding below VM argument in eclipse.ini or on the command line after -vmargs:
-Dswt.autoScale=200
Comment 4 Markus Keller CLA 2017-01-24 08:09:30 EST
Thanks for your investigations. I'll fix this for 4.7 M5 and will backport to Neon.3.
Comment 5 Markus Keller CLA 2017-01-24 08:18:50 EST
Niraj is right that we don't ship 300% images. The fix is only to avoid the crash, not to supply more image versions. At 300%, you will just get images that are scaled up from the 100% version.

Fixed for next I-build with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=57e5baff5e882b0fcdc75673394ca9aaf4f11053

Cedric, did you actually plan to work with a 300% zoom level, or did you just set this for testing purposes?
Comment 6 Cedric Dumoulin CLA 2017-01-24 09:24:21 EST
(In reply to comment #5)

> Cedric, did you actually plan to work with a 300% zoom level, or did you just
> set this for testing purposes?

I always work at 300% zoom level. 
The default value recommended by Windows 10 is 250% for this 4k screen, which for me is a little bit too small. So I have just move the scale at the next proposed level.
Comment 7 Niraj Modi CLA 2017-01-27 06:50:41 EST
(In reply to Markus Keller from comment #5)
> Fixed for next I-build with
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=57e5baff5e882b0fcdc75673394ca9aaf4f11053

Verified the fix in Oxygen M5 IBuild: I20170126-1030 on Win7 using -Dswt.autoScale=300 options.
Comment 8 Cedric Dumoulin CLA 2017-01-27 08:13:45 EST
(In reply to comment #5)

> Fixed for next I-build with
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=57e5baff5e882b0fcdc75673394ca9aaf4f11053
> 
I have tried the fix with compiled src from trunk.
Oxygen now start without crash. 
So, this bug is fixed for me.

But, there still some problems at scale 300% : some buttons are missing in toolbars, without any errors.
I have opened a new bug for that :
511188: [HiDPI] Some buttons/icons are missing in views toolbars when scale is set to 300%  (4k screen)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=511188
Comment 9 Markus Keller CLA 2017-02-08 14:58:51 EST
I tried to reproduce on 4.6.3 before backporting, but the bug didn't show up.

Turned out this got recently broken by bug 507103. I actually remembered that I tested many resolutions when I wrote that code, and it was reassuring to see it wasn't me who made such mistakes.

Nothing to do for 4.6.3, closing as fixed in 4.7 M5.