Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350783 - certain images cause "no more handles" on win7
Summary: certain images cause "no more handles" on win7
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2 M3   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 04:44 EDT by Daniel Schaarschmidt CLA
Modified: 2011-10-04 17:23 EDT (History)
5 users (show)

See Also:


Attachments
Stack Trace SWTErrror (6.74 KB, text/plain)
2011-06-30 04:46 EDT, Daniel Schaarschmidt CLA
no flags Details
snippet (1.29 KB, text/plain)
2011-08-15 20:14 EDT, Benjamin Muskalla CLA
no flags Details
logo.jpg (216.87 KB, image/jpeg)
2011-08-15 20:15 EDT, Benjamin Muskalla CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Schaarschmidt CLA 2011-06-30 04:44:54 EDT
Build Identifier: 20110615-0604

When searching for a certain plugin using the marketplace client the query takes quite a lot of time and then crashes with an Unhandled event loop exception: SWTError: No more handles.

I can reproduce this with a clean JavaEE-Package install, everytime I switch to the Yoxos marketplace and do search for "Target Management" it crashes this way. Searching for other things is fine, searching for Target Management in the Eclipse marketplace, too.

Reproducible: Always

Steps to Reproduce:
1. Open Marketplace Client
2. Switch to Yoxos marketplace 
3. Type "Target Management" in the find box and press enter
Comment 1 Daniel Schaarschmidt CLA 2011-06-30 04:46:12 EDT
Created attachment 198880 [details]
Stack Trace SWTErrror
Comment 2 Benjamin Muskalla CLA 2011-07-02 08:22:46 EDT
Thanks Daniel for the detailled steps but I'm not able to reproduce it with your steps. Tthis problem can always happen in case one of the plugins is leaking resources (eg. images, fonts, ..). I'll use this task to check the resource dispose again for MPC in case we missed it at some point.
Comment 3 Benjamin Muskalla CLA 2011-07-20 19:29:44 EDT
So in MPC we don't have any leaked resources. Another case I see is that Yoxos returns an unmanageable amount of items and we fail to limit them in some way. As I cannot reproduce this, closing it for now.

Daniel, I'd be happy to provide a fix for this but I'm not able to reproduce. If you have any additional hints, that would be great.
Interesting to know would be if this happend with Helios or Indigo.
Comment 4 Daniel Schaarschmidt CLA 2011-07-21 11:10:34 EDT
I first noticed it with Indigo(x64) but can reproduce it with Helios (x86) on my and my colleagues machines, too.
It seems only to happen on our Windows machines (all were Win 7 x64). With OpenSuse 11.4 and Indigo there were no problems at all.

Not only searching for "target management" crashes, searching for "management" alone is enough to bring Eclipse down.
Comment 5 Benjamin Muskalla CLA 2011-07-21 12:56:19 EDT
Ok, I managed to reproduce it on a windows machine. On Linux this does not happen. Will look into it. Thanks Daniel!
Comment 6 Benjamin Muskalla CLA 2011-08-15 20:14:04 EDT
Ok, essentially: not a MPC problem but an SWT bug. One of the images delivered by the Yoxos marketplace let SWT throw up, image in question is the logo of the Maven plugins: http://market.eclipsesource.com/places/doc/org.maven.ide.eclipse.feature.feature.group/logo.jpg

Short fix: Markus, please replace the image in the Yoxos marketplace with something else and test on Win7

Long fix: Over to you SWT, see attached snippets to reproduce. SWT can't read image anyway (neither on Windows nor on Linux) but on Windows 7, using this image and creating it via an *local* url descriptor leads to "No more handles" (url descriptor using http works, read: returns broken image). See attached snippet.
Comment 7 Benjamin Muskalla CLA 2011-08-15 20:14:28 EDT
Created attachment 201532 [details]
snippet

.
Comment 8 Benjamin Muskalla CLA 2011-08-15 20:15:20 EDT
Created attachment 201533 [details]
logo.jpg

problematic image
Comment 9 Felipe Heidrich CLA 2011-09-26 10:06:22 EDT
Silenio, the pixel format for the problematic image is PixelFormat32bppCMYK.

Note that we failed to load this image with the native loader:
Image image = new Image(display, "logo.jpg");
Exception in thread "main" org.eclipse.swt.SWTError: No more handles
	at org.eclipse.swt.SWT.error(SWT.java:4309)
	at org.eclipse.swt.SWT.error(SWT.java:4198)
	at org.eclipse.swt.SWT.error(SWT.java:4169)
	at org.eclipse.swt.graphics.Image.initNative(Image.java:752)
	at org.eclipse.swt.graphics.Image.<init>(Image.java:579)
	at Leak.main(Leak.java:31)

Image image = new Image(display, new ImageData("logo.jpg"));
and the java loader:
Exception in thread "main" org.eclipse.swt.SWTException: Invalid image
	at org.eclipse.swt.SWT.error(SWT.java:4283)
	at org.eclipse.swt.SWT.error(SWT.java:4198)
	at org.eclipse.swt.SWT.error(SWT.java:4169)
	at org.eclipse.swt.internal.image.JPEGDecoder.error(JPEGDecoder.java:2259)
	at org.eclipse.swt.internal.image.JPEGDecoder.loadFromByteStream(JPEGDecoder.java:6321)
	at org.eclipse.swt.internal.image.JPEGFileFormat.loadFromByteStream(JPEGFileFormat.java:1383)
	at org.eclipse.swt.internal.image.FileFormat.loadFromStream(FileFormat.java:48)
	at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:84)
	at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:130)
	at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:157)
	at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:26)
	at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:377)
	at Leak.main(Leak.java:32)
Comment 10 Felipe Heidrich CLA 2011-09-26 10:07:32 EDT
Ben, your best workaround is to convert this image to some other pixel format (like RGBA, etc).
Comment 11 Carolyn MacLeod CLA 2011-10-04 11:55:25 EDT
Just FYI, this is a broken image in IE8, and the colors load incorrectly under Quicktime. So you will definitely want to switch to a more common pixel format.

Leaving this bug open to one day add support for PixelFormat32bppCMYK. Changing bug type to 'enhancement'.
Comment 12 Benjamin Muskalla CLA 2011-10-04 12:02:26 EDT
I think the "bug" in this case is still valid to throw the same errors on all operating systems.
Comment 13 Carolyn MacLeod CLA 2011-10-04 12:11:00 EDT
Yes, I suppose we shouldn't crash if we get an unhandled pixel format... ;)
SSQ, maybe I should just set the error to Invalid Image for all unknown pixel
formats? Looking at the code, I don't think it truly ran out of handles.
Comment 14 Silenio Quarti CLA 2011-10-04 13:01:16 EDT
(In reply to comment #13)
> Yes, I suppose we shouldn't crash if we get an unhandled pixel format... ;)
> SSQ, maybe I should just set the error to Invalid Image for all unknown pixel
> formats? Looking at the code, I don't think it truly ran out of handles.

I believe you right.
Comment 15 Carolyn MacLeod CLA 2011-10-04 15:42:08 EDT
Noticed (FYI) that we load the image correctly on WinXP.
Strange. It's as if Windows 7 broke their native image loading code...
I'll look at this more closely.
Comment 16 Carolyn MacLeod CLA 2011-10-04 16:15:20 EDT
Huh - bizarre. WinXP is changing the pixel format of the image to be PixelFormat24bppRGB.
Felipe, can you try your snippet again, except change the code in Image.initNative(String) so that the switch(pixelFormat) handles PixelFormat32bppCMYK, i.e.

   case Gdip.PixelFormat24bppRGB:
   case 8207: //Gdip.PixelFormat32bppCMYK:    <<< add this line
      this.handle = createDIB(width, height, 24);
      break;

and see what happens? <g>
Comment 17 Carolyn MacLeod CLA 2011-10-04 16:20:40 EDT
It looks like we are not the only ones to trip over this problem:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/c626a478-e5ef-4a5e-9a73-599b3b7a6ecc
Comment 18 Carolyn MacLeod CLA 2011-10-04 17:23:56 EDT
That fixed it.
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=07bbcf11868d01025ec708e21da08af7b897caa1

So you can load a CMYK jpeg swt Image natively on Windows 7 now (i.e. using Image constructor).

You can't load using ImageData, but that is captured in bug 290164 - [Image Loading] ImageLoader cannot load JPEG files with CYMK color model