Bug 427061 - OOME in Plug-in Image Browser
Summary: OOME in Plug-in Image Browser
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.4 M6   Edit
Assignee: Vikas Chandra CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2014-01-30 18:56 EST by Martin Mathew CLA
Modified: 2014-03-04 15:59 EST (History)
5 users (show)

See Also:
curtis.windatt.public: review+


Attachments
Log file (71.00 KB, application/octet-stream)
2014-01-30 18:56 EST, Martin Mathew CLA
no flags Details
patch to fix it (5.78 KB, patch)
2014-02-06 05:04 EST, Vikas Chandra CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mathew CLA 2014-01-30 18:56:05 EST
Created attachment 239497 [details]
Log file

Eclipse SDK
Version: 4.3.2
Build id: M20140129-0800

Open Plug-in Image Browser. Keep changing the values in the "Source" and "Show" combo boxes. After 4 attempts you can see Eclipse slowing down and in few more attempts Eclipse freeze with OOME. Attached is the log file with the exception details.

!ENTRY org.eclipse.core.jobs 4 2 2014-01-31 10:28:28.754
!MESSAGE An internal error occurred during: "Scan for UI images".
!STACK 0
java.lang.OutOfMemoryError: Java heap space
	at org.eclipse.swt.internal.image.PNGFileFormat.loadFromByteStream(PNGFileFormat.java:51)

Note: This happened in my development WS where i had *.jdt.core and *.jdt.ui plug-ins checked-out from the BETA_JAVA8 git repositories. When the same steps were followed in a fresh WS, the OOME did not occur, but the Plug-in Image Browser was empty after changing the combo values a few times.
Comment 1 Vikas Chandra CLA 2014-01-31 04:01:40 EST
I am able to recreate this. I am looking at it.
Comment 2 Vikas Chandra CLA 2014-02-02 06:24:18 EST
This has many *independent* problems.

1) An internal error occurred during: "Scan for UI images"/OOM

org.eclipse.gmt.modisco.kdm.browser.extension_*.jar has cons\kdm\kdm\unresolved.gif has invalid data. Thats why SWT image data initialisation fails. Later on there are issues retrieving image data in PDE's size filter.

So
a) Bug should be filed on org.eclipse.gmt.modisco.*
b) PDE should handle invalid image data.

2) the Plug-in Image Browser was empty after changing the combo values a few times.

This happens in all environments. And there is a basic flaw.

This happens because TargetPlatformRepository keeps on removing the bundles once they are processed. The optimization ensures that same class object is used. However once all bundles are processed ( after 5-6 attempts of combo-value change), then there is no processing at all. Further even in the first 5-6 times, different set of result are given. ( not wrong but inconsistent). And if the max size image is large, the number of images given will reduce after every attempt. ( wrong !). 

The fix is to override run method and clear bundle each time. This needs to be done for WorkspaceRepository as well.

3) If the previous image scan is going on, processing the new scan gives inconsistent results.

The previous job needs to cancelled once the combo is changed.


I have fix for 1b), 2 and 3).  After these changes all these 3 problems were resolved. I will attach a fix tomorrow.

Also I will file a bug for 1a) with  org.eclipse.gmt.modisco. regarding packaging of invalid image.
Comment 3 Vikas Chandra CLA 2014-02-03 03:32:24 EST
The error handling was ok. But bug needs to be filed for invalid image. The fix for rest of the issues is https://git.eclipse.org/r/#/c/21435/

Curtis, can you please review this.
Comment 4 Vikas Chandra CLA 2014-02-06 05:04:37 EST
Created attachment 239691 [details]
patch to fix it

patch to fix it
Comment 5 Vikas Chandra CLA 2014-02-06 05:05:51 EST
There were some issues with gerrit. So I am attaching a code patch for this issue.
Comment 6 Curtis Windatt CLA 2014-02-10 17:33:45 EST
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=e47eb975aea6733c60ddb22f64750d7841adc209
+1, works great, fixes the issues with the combo, fixed in master
Comment 7 Vikas Chandra CLA 2014-03-04 12:11:04 EST
Verified for Eclipse(4.4) Luna M6 using build eclipse-SDK-I20140303-2000-win32-x86_64