Bug 576146 - [Browser][Edge] vm crash after executing BrowserFunction
Summary: [Browser][Edge] vm crash after executing BrowserFunction
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.21   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 575660
  Show dependency tree
 
Reported: 2021-09-21 08:15 EDT by Flavio Donze CLA
Modified: 2022-01-03 03:31 EST (History)
3 users (show)

See Also:


Attachments
demo project containing the code to crash (72.50 KB, application/x-zip-compressed)
2021-09-21 08:15 EDT, Flavio Donze CLA
no flags Details
crash dump file (53.99 KB, application/octet-stream)
2021-09-21 08:16 EDT, Flavio Donze CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Flavio Donze CLA 2021-09-21 08:15:43 EDT
Created attachment 287177 [details]
demo project containing the code to crash

Switching a RCP application to use Edge (-Dorg.eclipse.swt.browser.DefaultType=edge), the vm crashes executing the following code:

	Button runButton = new Button(parent, SWT.PUSH);
	runButton.setText("open");
	runButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.CLOSE);
			shell.setLayout(new FillLayout(SWT.HORIZONTAL));

			Browser browser = new Browser(shell, SWT.NONE);
			browser.setText("<a href=\"javascript:jsTest();\">run</a>");
			new BrowserFunction(browser, "jsTest") {
				@Override
				public Object function(Object[] arguments) {
					shell.close();
					return null;
				}
			};
			shell.open();
		}
	});

Attached is a demo project based on the "RCP 3.x application with a view" template. 
Using a Browser with BrowserFunction, after clicking on the button "open" and "run" in the browser-shell the vm crashes with the following log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000000000000, pid=9136, tid=28176
#
# JRE version: OpenJDK Runtime Environment Zulu17.28+13-CA (17.0+35) (build 17+35-LTS)
# Java VM: OpenJDK 64-Bit Server VM Zulu17.28+13-CA (17+35-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  0x0000000000000000
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\dev\software\eclipse\hs_err_pid9136.log
#

hs_err_pid9136.log is attached to this issue.


Environment:
Eclipse 2021-09 (4.21)
Windows 10 Pro for Workstations: 21H1
Java jdk17.0.0
Comment 1 Flavio Donze CLA 2021-09-21 08:16:28 EDT
Created attachment 287178 [details]
crash dump file
Comment 2 Kent Xu CLA 2022-01-02 12:56:47 EST
I have run into this problem too with Edge browser. One possible workaround is to invoke "close" in an async task instead of calling it directly.