Bug 546579 - [GTK] webkit2_BrowserProblem
Summary: [GTK] webkit2_BrowserProblem
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.11   Edit
Hardware: PC other
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2019-04-18 19:56 EDT by Patrick Mackinlay CLA
Modified: 2020-10-14 14:40 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Mackinlay CLA 2019-04-18 19:56:53 EDT
eclipse 4.11 is unusable on FreeBSD. It block all the time for 10 seconds.

running with openjdk8-8.202.8, depends on webkit2-gtk3-2.24.0_1

java.lang.Throwable: 
        at org.eclipse.swt.browser.WebKit.getStackTrace(WebKit.java:489)
        at org.eclipse.swt.browser.WebKit.getInternalErrorMsg(WebKit.java:482)
        at org.eclipse.swt.browser.WebKit.access$1(WebKit.java:472)
        at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.execAsyncAndWaitForReturn(WebKit.java:1907)
        at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.runjavascript(WebKit.java:1796)
        at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.evaluate(WebKit.java:1744)
        at org.eclipse.swt.browser.WebKit.evaluate(WebKit.java:1930)
        at org.eclipse.swt.browser.WebKit.close(WebKit.java:1551)
        at org.eclipse.swt.browser.WebKit.onDispose(WebKit.java:2563)
        at org.eclipse.swt.browser.WebKit.lambda$4(WebKit.java:1312)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5783)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1411)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1437)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
        at org.eclipse.swt.widgets.Widget.release(Widget.java:1228)
        at org.eclipse.swt.widgets.Control.release(Control.java:4570)
        at org.eclipse.swt.widgets.Widget.dispose(Widget.java:526)
        at org.eclipse.jface.internal.text.html.BrowserInformationControl.isAvailable(BrowserInformationControl.java:89)
        at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover$HoverControlCreator.doCreateInformationControl(JavadocHover.java:428)
        at org.eclipse.jface.text.AbstractReusableInformationControlCreator.createInformationControl(AbstractReusableInformationControlCreator.java:46)
        at org.eclipse.jface.text.AbstractInformationControlManager.getInformationControl(AbstractInformationControlManager.java:829)
        at org.eclipse.jface.text.AbstractInformationControlManager.internalShowInformationControl(AbstractInformationControlManager.java:1138)
        at org.eclipse.jface.text.AbstractInformationControlManager.presentInformation(AbstractInformationControlManager.java:1120)
        at org.eclipse.jface.text.AbstractHoverInformationControlManager.presentInformation(AbstractHoverInformationControlManager.java:884)
        at org.eclipse.jface.text.TextViewerHoverManager.doPresentInformation(TextViewerHoverManager.java:251)
        at org.eclipse.jface.text.TextViewerHoverManager.lambda$0(TextViewerHoverManager.java:241)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5026)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4582)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1476)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1449)

 Additional information about the error is as following:
 The following javascript was executed:
function SWTWebkit2TempFunc1(){return SWTExecuteTemporaryFunctionCLOSE(window);}; SWTWebkit2TempFunc1()
Comment 1 Eric Williams CLA 2019-08-13 12:05:15 EDT
Which GTK3 version are you using? X11 or Wayland?
Comment 2 Patrick Mackinlay CLA 2019-08-13 13:43:40 EDT
I am not 100% sure what wayland is. I am running /usr/local/bin/X (from the xorg-server-1.18.4_11,1), I think that means I am not running wayland.
Comment 3 Eric Williams CLA 2019-08-13 15:07:27 EDT
(In reply to Patrick Mackinlay from comment #2)
> I am not 100% sure what wayland is. I am running /usr/local/bin/X (from the
> xorg-server-1.18.4_11,1), I think that means I am not running wayland.

Yeah, that would be X11.

Which GTK3 version?
Comment 4 Patrick Mackinlay CLA 2019-08-13 16:03:54 EDT
Version 2.22.6 works, 2.24.0 and 2.24.3 dont
Comment 5 Patrick Mackinlay CLA 2019-08-13 16:04:54 EDT
gtk version 3.24.10
Comment 6 Patrick Mackinlay CLA 2019-08-13 16:07:22 EDT
So, to be clear, webkit2-gtk3 2.22.6 works, webkit2-gtk3 2.24.0 and 2.24.3 dont.
All of this was with gtk3 version 3.24.10 (freebsd port gtk3-3.24.10_1)
Comment 7 Eric Williams CLA 2019-08-13 16:11:21 EDT
Interesting, sounds like something in WebKit changed. Any specific steps to reproduce the issue?
Comment 8 Patrick Mackinlay CLA 2019-08-13 16:15:17 EDT
To reproduce, 
 1. Start eclipse (in a terminal) with an empty workspace.
 2. Close the welcome panel.
 3. Create a new java 1.8 java project, TestProject (File->New->Java Project).
 4. Create a new java class, Test.java (File->New->Class).
 5. Create a new toString() method in the Test class using autocomplete (Position the mouse cursor in the body of the test class, type "to" and press CTRL-SPACE, select the toString option, but then do nothing else)
 6. Eclipse should then add an empty toString method almost immediately, however after 10 seconds the exception will occur (will appear in your terminal window).

Note that this scenario will trigger the bug, but the GUI thread will not block and so the bug appears fairly benign. In my normal use, where I am using autocomplete continusouly (to complete variable names, method names, classes etc.) the GUI thread eventually blocks and eclipse becomes unusable. You can try deleting the toString() method and doing it again, the second time round appears worse. If you try to create toString(), then equals() and then hashCode() methods relatively quickly one after another, using autocomplete after the first two letters, you will probably block your GUI thread, or at the very least it will fail to autocomplete.
Comment 9 Patrick Mackinlay CLA 2019-08-13 16:24:48 EDT
Note that this is all on FreeBSD, I also have a headless arch linux box. Running eclipse on the arch linux box with my display on my FreeBSD box (ssh -Y) all works fine. With the arch linux box running

gtk3 1:3.24.8+177+gae2ef1472c-1
webkit2gtk 2.24.3-1
eclipse-common 4.12-1
eclipse-java 4.12-1

The bug is also reported on freebsd ports at

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238844

Someone had a look at it, but still cant figure out whats wrong.
Comment 10 Eric Williams CLA 2019-08-14 09:08:09 EDT
(In reply to Patrick Mackinlay from comment #9)
> Note that this is all on FreeBSD, I also have a headless arch linux box.
> Running eclipse on the arch linux box with my display on my FreeBSD box (ssh
> -Y) all works fine. With the arch linux box running
> 
> gtk3 1:3.24.8+177+gae2ef1472c-1
> webkit2gtk 2.24.3-1
> eclipse-common 4.12-1
> eclipse-java 4.12-1
> 
> The bug is also reported on freebsd ports at
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238844
> 
> Someone had a look at it, but still cant figure out whats wrong.

This sounds like a FreeBSD issue then? Doesn't seem like anything in Eclipse is causing this.
Comment 11 Mikhail Zhilin CLA 2019-08-14 09:10:40 EDT
It could be, it could be not. 

We wonder what is possible way to identify root cause of issue. We will appreciate any hint ;)
Comment 12 Eric Williams CLA 2019-08-14 10:19:42 EDT
(In reply to Mikhail Zhilin from comment #11)
> It could be, it could be not. 
> 
> We wonder what is possible way to identify root cause of issue. We will
> appreciate any hint ;)

WebKit2 in SWT is kind of complicated - there is some IPC going on between the main SWT process, and a WebKit Web Extension which renders Javascript. The error you're running into (I believe) is due to a deadlock/timeout while this communication is happening.

A few things could be happening: 1) GDBus isn't working, 2) Something is blocking the IPC, 3) Some behaviour specific to FreeBSD is causing the Web Extension to be unable to return values to SWT, or is causing SWT to be busy when the return comes back.

My bets are on 1) or 3). Can you launch Eclipse from the terminal, reproduce the bug, and provide the output (if any) in the terminal? There may be some WebKit related warning messages which could be useful.
Comment 13 Wenhui Huang CLA 2020-02-28 21:48:36 EST
I use debug version webkit2-gtk3-2.26.4 and swt example, and got this error:
% /usr/local/openjdk11/bin/java -Dfile.encoding=UTF-8 -classpath /opt/workspace/Test/target/classes:/opt/workspace/Test/swt.jar org.eclipse.swt.examples.controlexample.ControlExample 
ASSERTION FAILED: isUIThread()
/usr/ports/www/webkit2-gtk3/work/webkitgtk-2.26.4/Source/WebCore/platform/ProcessIdentifier.cpp(38) : void WebCore::Process::setIdentifier(WebCore::ProcessIdentifier)
Abort

The debug version of webkit2-gtk3-2.22.6 did not have this problem.
Comment 14 Wenhui Huang CLA 2020-02-29 07:44:24 EST
I disable PTHREAD_MAIN_NP in webkitgtk-2.26.4/Source/WTF/wtf/generic/MainThreadGeneric.cpp, Eclipse 4.11 works again on FreeBSD!
Comment 15 Patrick Mackinlay CLA 2020-03-01 03:16:44 EST
I can confirm that the pthread cmake config change does in fact seem to work. 

I tried it with webkit2-gtk3-2.26.4 and eclipse-4.12_1. I do still get the occasional "SWT call to Webkit timed out after 10000ms" error (see my first comment), but it does not seem to affect the usability of eclipse. All my popups work and the GUI never seems to block.

Thanks very much Wenhui Huang