Bug 207252 - [Browser] SWT Browser causes SWTError No more handles
Summary: [Browser] SWT Browser causes SWTError No more handles
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2007-10-23 22:20 EDT by Ashish Patel CLA
Modified: 2010-06-24 08:59 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ashish Patel CLA 2007-10-23 22:20:14 EDT
I'm finding a very odd occurrence that I haven't been able to solve.  When I start the workbench with my view in a clean workspace the browser works, and I'm able to collect some data from the browser and save that to a file.  When I close the workspace and open it again, (w/o cleaning the workspace) and open the file I saved, I get the following error and the browser doesn't render.  If I create a new clean workspace and copy my saved file in there and open it, the browser works.

How do I go about fixing this?  Any help is appreciated - I'm not sure if this is a bug or if there is a workaround....  I searched for "org.eclipse.swt.browser.Browser.<init>(Browser.java:194)" on google and got one entry reporting the same issue but no followup/responses.

org.eclipse.swt.SWTError: No more handles
	at org.eclipse.swt.SWT.error(SWT.java:3400)
	at org.eclipse.swt.SWT.error(SWT.java:3297)
	at org.eclipse.swt.SWT.error(SWT.java:3268)
	at org.eclipse.swt.browser.Browser.<init>(Browser.java:194)
Comment 1 Ashish Patel CLA 2007-11-04 13:17:39 EST
I did some more tracing and found something that maybe you can shed light on.  It seems to be with the OLE stuff.

The SWT Exception gets fired because OleControlSite:99 returns a bad result code:

int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
if (result != COM.S_OK)
   OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);

In my debugger, COM.OleCreate returns -2147221164 which causes the OLE.error command on line OleControlSite:101 to fire.  This triggers all the SWT exceptions up the stack.

Any thoughts?
Comment 2 Grant Gayed CLA 2007-11-19 12:53:00 EST
I've never heard of a problem like this before.  Questions:

- what is the value of String progId that is passed to the OleControlSite constructor where the error occurs?

- is this reproducable on other's machines?  Are you able to send the file that makes this happen so that I can try to reproduce it?

- if you run regedit on your machine:
  - what is the value of HKEY_CLASSES_ROOT>Shell.Explorer>CLSID and HKEY_CLASSES_ROOT>Shell.Explorer>CurVer?
  - do you have a registry entry whose name is the value of HKEY_CLASSES_ROOT>Shell.Explorer>CurVer?  (eg.- this is typically Shell.Explorer.2)
Comment 3 Grant Gayed CLA 2008-05-05 12:06:32 EDT
Timed out, closing report.  Please reopen if this still happens with a recent build such as http://download.eclipse.org/eclipse/downloads/drops/S-3.4M7-200805020100/index.php and you have more information, thanks.
Comment 4 Christian Holm CLA 2010-04-23 05:56:32 EDT
We are seeing this problem with SWT 3.4.2 on a lot of clients computer. We are unable to reproduce it in-house. 

I think it would be very benificial in the future to not catch the SWTException in IE.create, and rethrow SWT.ERROR_NO_HANDLES as this is really just a mad guess, which makes it very hard to diagnose problems in the wild.

I suggest you reopen this bug, and just rethrow the original SWTException after the browser has been disposed.
Comment 5 Grant Gayed CLA 2010-04-23 16:16:20 EDT
It's true that the ERROR_NO_HANDLES hides the underlying OLE problem contained in the SWTException.  However throwing an OLE-level exception like this from Browser would be exposing implementation detail that a Browser client should not care about.  I understand how it would be helpful in your case, but would be inconsistent with swt's API implementation throughout.

More importantly, changing this behaviour would also be an API break, because Browser's constructor is spec'd to throw SWTException iff calling from an invalid thread, and SWTError for other instantiation problems.  It's rare that this distinction matters on Windows, but on *ix it's more common for Browser instantiations to fail, so swt clients have been dependent for years on catching SWTError to handle cases like this.  This cannot be changed now.
Comment 6 Christian Holm CLA 2010-05-03 06:13:43 EDT
Is it at least possible to log the message somehow, so its possible to diagnose this problem in the wild? It seems to me the only way we can understand what is wrong is to debug the application. Since we cannot reproduce this internally, this would require us to setup a remote debugging session; not simple at all.
Comment 7 Christian Holm CLA 2010-06-24 08:04:14 EDT
Could you reopen this bug, as the issue is not at all resolved? At least add some logging so developers have a chance of diagnosing problems.
Comment 8 Grant Gayed CLA 2010-06-24 08:59:17 EDT
I've logged bug 317810 for this.