Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser widget error when executing Javascript code: SWT call to Webkit timed out after 10000ms. #1800

Open
brotenet opened this issue Feb 4, 2025 · 0 comments
Labels
bug Something isn't working Linux/GTK Happens on Linux Webkit

Comments

@brotenet
Copy link

brotenet commented Feb 4, 2025

Describe the bug

I am trying run the following Javascript code to modify an H2 HTML element within a Browser widget using the following code:
myBrowser.execute("document.getElementById('h2ChangeMe').innerText = '" + UUID.randomUUID().toString() + "';");

To Reproduce

Use Linux in order to make use of the GTK toolkit.

  1. Create an SWT Shell that contains a Browser widget as content.
  2. Set the the Browser widget text to the following HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
	<h2 id="h2ChangeMe">Some Title</h2>
</body>
</html>
  1. Add a progress listener to the Browser widget to execute the javascript code after page load:
myBrowser.addProgressListener(new ProgressAdapter() {
			@Override
			public void completed(ProgressEvent event) {
				execute("document.getElementById('h2ChangeMe').innerText = '" + UUID.randomUUID().toString() + "';");
			}
		});

Expected behavior
Once the app starts and reaches to the point where the "execute()" method runs, the execution hangs for more than 10000ms and the following message is printed out on std error:

SWT call to Webkit timed out after 10000ms. No return value will be provided.
followed with instructions on how to file this bug issue.

FULL TRACE:

SWT call to Webkit timed out after 10000ms. No return value will be provided.
Possible reasons:
1) Problem: Your javascript needs more than 10000ms to execute.
   Solution: Don't run such javascript, it blocks Eclipse's UI. SWT currently allows such code to complete, but this error is thrown 
     and the return value of execute()/evalute() will be false/null.

2) However, if you believe that your application should execute as expected (in under10000 ms),
 then it might be a deadlock in SWT/Browser/webkit2 logic.
 I.e, it might be a bug in SWT (e.g this does not occur on Windows/Cocoa, but occurs on Linux). If you believe it to be a bug in SWT, then
Please report this issue *with steps to reproduce* via:
 https://github.com/eclipse-platform/eclipse.platform.swt/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=
For bug report, please attach this stack trace:
java.lang.Throwable: 
	at org.eclipse.swt.browser.WebKit.getStackTrace(WebKit.java:293)
	at org.eclipse.swt.browser.WebKit.getInternalErrorMsg(WebKit.java:286)
	at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.execAsyncAndWaitForReturn(WebKit.java:1268)
	at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.runjavascript(WebKit.java:1026)
	at org.eclipse.swt.browser.WebKit.execute(WebKit.java:893)
	at org.eclipse.swt.browser.Browser.execute(Browser.java:538)
	at application.gui.CmpMainPageController.onActivity(CmpMainPageController.java:37)
	at openjdk.tools.swt.widgets.web.PageController$1.function(PageController.java:45)
	at org.eclipse.swt.browser.WebKit.RequestProc(WebKit.java:454)
	at org.eclipse.swt.internal.gtk3.GTK3.gtk_main_iteration_do(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4516)
	at openjdk.tools.swt.application.ApplicationInstance.startAndJoin(ApplicationInstance.java:116)
	at openjdk.tools.swt.application.ApplicationInstance.start(ApplicationInstance.java:63)
	at application.Main.main(Main.java:11)

 Additional information about the error is as following:
 The following javascript was executed:
document.getElementById('h2ChangeMe').innerText = '60457591-30cb-4602-a043-e2ff08d65262';

Screenshots
Image

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
  Kernel: 6.8.0-52-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 clocksource: tsc
  Desktop: Cinnamon v: 6.4.6 tk: GTK v: 3.24.41 wm: Muffin v: 6.4.1 vt: 7 dm: LightDM v: 1.30.0
    Distro: Linux Mint 22.1 Xia base: Ubuntu 24.04 noble
  1. JRE/JDK version
openjdk version "21.0.5" 2024-10-15
OpenJDK Runtime Environment (build 21.0.5+11-Ubuntu-1ubuntu124.04)
OpenJDK 64-Bit Server VM (build 21.0.5+11-Ubuntu-1ubuntu124.04, mixed mode, sharing)

Version since
3.126.0.v20240528-0813
up to latest (4.34)

Workaround (or) Additional context
No workarounds.
WEBKIT_DISABLE_COMPOSITING_MODE=1 and/or WEBKIT_DISABLE_DMABUF_RENDERER=1 environment variables did not seem to have any effect.

@fedejeanne fedejeanne added bug Something isn't working Linux/GTK Happens on Linux Webkit labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Linux/GTK Happens on Linux Webkit
Projects
None yet
Development

No branches or pull requests

2 participants