SWT StackOverflowError on Windows
Recently I was chasing down a crash report from a customer on Windows 7. The underlying exception trace is summarized as follows:
java.lang.StackOverflowError
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.browser.IE.navigate(Unknown Source)
at org.eclipse.swt.browser.IE.setUrl(Unknown Source)
at org.eclipse.swt.browser.IE$7.handleEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.access$100(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink$1.method6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.browser.IE.navigate(Unknown Source)
at org.eclipse.swt.browser.IE.setUrl(Unknown Source)
at org.eclipse.swt.browser.IE$7.handleEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.access$100(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink$1.method6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.browser.IE.navigate(Unknown Source)
at org.eclipse.swt.browser.IE.setUrl(Unknown Source)
at org.eclipse.swt.browser.IE$7.handleEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink.access$100(Unknown Source)
at org.eclipse.swt.ole.win32.OleEventSink$1.method6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(Unknown Source)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(Unknown Source)
at org.eclipse.swt.browser.IE.navigate(Unknown Source)
at org.eclipse.swt.browser.IE.setUrl(Unknown Source)
(I think you get the idea from here...)
This is also documented on the Eclipse SWT bug tracker as issue 473934. I haven't seen this specific crash since 2018, and the SWT bug tracker issue was closed for inactivity.
On this Windows PC, trying to set a URL for a newly-made SWT Browser widget (using Internet Explorer for the browser) caused an infinite recursion, which eventually led to a StackOverflowError
:
-
On the first call to
setUrl()
on the new browser widget, the IE Browser widget internals first tries setting the url toabout:blank
to clear up some other issues for new Browser widgets. -
That actually ends up failing, since the underlying problem on this Windows computer is that the registry entry specifying the "about" protocol handler is broken.
-
The IE Browser code checks to see if the current url is set to figure out if it's a new browser widget, and it's not (because the
about:blank
set failed), so the Browser widget still assumes it needs to do that initial call to set the url toabout:blank
. -
And we're back to number 1 above. Rinse, repeat, stack overflow.
The underlying problem is a configuration issue on this computer. The underlying issue is that the protocol handler registry key for about
is incorrect or non-existent, so that initial about:blank
url set fails, starting the vicious cycle.
As I post in the SWT bug tracker ticket, the missing registry key at the time I wrote this, which is appropriate for IE 11 is:
[HKEY_CLASSES_ROOT\PROTOCOLS\Handler\about]
"CLSID"="{3050F406-98B5-11CF-BB82-00AA00BDCE0B}"
You should definitely compare on your clean (working) test computer to make sure that key matches what you have, in case it's changed since I wrote this. You can add that key manually to the broken machine if IE 11 is installed and it should fix the issue. Or, you can uninstall IE 11 and reinstall it, which should rewrite the correct registry keys. Uninstalling IE 11 and reinstalling it is a bit of a pain though.
Write A Comment