Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343550 - [64] Browser1 test crashes with IBM JRE
Summary: [64] Browser1 test crashes with IBM JRE
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-21 10:26 EDT by Grant Gayed CLA
Modified: 2020-07-02 13:04 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 Grant Gayed CLA 2011-04-21 10:26:58 EDT
The test doesn't crash with the latest Oracle JRE.  Need to investigate whether it's a problem in swt or in the IBM JRE.
Comment 1 Grant Gayed CLA 2011-04-21 10:27:36 EDT
Also note, running the Browser1 test alone doesn't crash.  Run the AllBrowserTests junit test.
Comment 2 Grant Gayed CLA 2011-04-21 13:06:33 EDT
crash doesn't happen with 32-bit IBM JRE (same machine)
Comment 3 Grant Gayed CLA 2011-04-28 14:53:05 EDT
snippet:

public static void main(String[] argv) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	final Browser browser = new Browser(shell, SWT.NONE);
	browser.addLocationListener(new LocationAdapter() {
		public void changing(LocationEvent event) {
			shell.close(); // <--- bad guy
		}
	});
	shell.open();
	browser.setUrl("http://www.google.com");
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
Comment 4 Grant Gayed CLA 2011-04-28 15:12:29 EDT
This reduced case also crashes with 32- and 64-bit JREs from IBM and Sun, so it doesn't appear to be a VM problem.
Comment 5 Grant Gayed CLA 2011-04-29 08:57:57 EDT
Actually there are likely two issues here.  To determine the second one the Browser1 test needs to be reduced to the point where it crashes with IBM's 64-bit JRE but not with the others.
Comment 6 Grant Gayed CLA 2011-05-28 23:37:13 EDT
Ok, I have the two issues separated out now:

1. There is an swt bug that affects both 32- and 64-bit cases, which is shown in the comment 3 snippet.

2. There is a behaviour difference between 32- and 64-bit that causes the Browser1 test case to try to do the bad thing in the comment 3 snippet when using 64-bit swt, but it never tries to do this with 32-bit swt.

The difference is that for some reason swt's OLE layer is delivering duplicate events when in 64-bit mode.  This difference can be seen with OLE-only snippet below, so it's nothing that the Browser control is doing.  When the snippet is run with 32-bit swtthere are two DocumentCompleted events printed, which is correct.  However when it's run with 64-bit swt there are five events printed, which is three too many.  Still to be determined is whether this is a problem in swt's OLE layer or in the IBM 64-bit JRE.

public class ModifiedSnippet123 {
static boolean first = true;
static OleAutomation webBrowser = null;
public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	OleControlSite controlSite;
	try {
		OleFrame frame = new OleFrame(shell, SWT.NONE);
		controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer");
		controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
	} catch (SWTError e) {
		System.out.println("Unable to open activeX control");
		display.dispose();
		return;
	}
	shell.open();
	webBrowser = new OleAutomation(controlSite);
	int DocumentComplete = 259;
	controlSite.addEventListener(DocumentComplete, new OleListener() {
		public void handleEvent(OleEvent event) {
			Variant varResult = event.arguments[1];
			String url = varResult.getString();
			System.out.println("DocumentComplete: " + url);
			if (first) {
				first = false;
				navigate("http://www.qwerty.com");
			}
		}
	});
	navigate("about:blank");
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	webBrowser.dispose();
	display.dispose();
}
public static void navigate(String url) {
	int[] ids = webBrowser.getIDsOfNames(new String[] {"Navigate", "URL"}); 
	Variant[] rgvarg = new Variant[] {new Variant(url)};
	int[] rgdispidNamedArgs = new int[] {ids[1]};
	webBrowser.invoke(ids[0], rgvarg, rgdispidNamedArgs);
}
}
Comment 7 Grant Gayed CLA 2012-05-29 16:11:31 EDT
I suspect this is a problem with the IBM 64-bit JRE (I have jvmwa6460sr9-20110203_74623).  The snippet in comment 6 works fine (two DocumentCompleted events are printed) with the Oracle 64-bit JRE 6u32.
Comment 8 Grant Gayed CLA 2014-05-08 16:51:36 EDT
Note that if this is resolved by some means then the workaround for it in bug 433400 can be removed.
Comment 9 Eclipse Genie CLA 2020-07-02 13:04:54 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.