Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 427776

Summary: [GTK3] JVM running Eclipse crashes several times per day to SIGSEGV in gdk_window_get_support_multidevice
Product: [Eclipse Project] Platform Reporter: Jari Juslin <zds>
Component: SWTAssignee: Alexander Kurtakov <akurtakov>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: akurtakov, apupier, arunkumar.thondapu, balusc, c.boscarino, chris.malloy.mri, daniel_megert, dgolovin, donhey, eclipse.sprigogin, hendy, jonny.lamb, malaperle, markus.kell.r, mcepl, mknauer, niraj.modi, romain.bioteau, tparker
Version: 4.4   
Target Milestone: 4.5 M7   
Hardware: PC   
OS: Linux-GTK   
See Also: https://git.eclipse.org/r/43156
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e9c202445b7800e816318f00aed3887885c67efd
https://git.eclipse.org/r/44711
Whiteboard:
Bug Depends on:    
Bug Blocks: 441566, 463102    
Attachments:
Description Flags
JVM core dump
none
experimental workaround
none
Notify mask workaround
none
Sample program none

Description Jari Juslin CLA 2014-02-10 04:54:28 EST
Created attachment 239776 [details]
JVM core dump

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fc55448eaf6, pid=6977, tid=140485714564864
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgdk-3.so.0+0x32af6]  gdk_window_get_support_multidevice+0x16
#
# Core dump written. Default location: /home/zds/core or core.6977
#
# An error report file with more information is saved as:
# /home/zds/hs_err_pid6977.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

The crashes sometimes happen elsewhere, but the gdk_window_get_support_multidevice+0x16 covers over 90% of the cases.

I am using Ubuntu 13.10 with Cinnamon 2.0.11 and have overlay-scrollbar uninstalled.
Comment 1 Jari Juslin CLA 2014-02-10 04:55:23 EST
To add: When the crash happens inside the libgdk-3.so.0, it's always at the same location: 0x32af6.
Comment 2 Arun Thondapu CLA 2014-02-10 07:52:45 EST
Can you provide any steps that can be used to reproduce this crash?

This seems like a duplicate of bug 419729 which was also reported against Ubuntu 13.10. Can you please try the workaround mentioned there (change the GTK theme from oxygen to something else) and update whether that helps?

Niraj, can you please try this on your Ubuntu 13.10 VM after installing the Cinnamon desktop environment? Thanks!
Comment 3 Jari Juslin CLA 2014-02-10 08:00:30 EST
I am not able to reproduce this instantly; I have not been able to pinpoint any single action that would do it every time.

On my .log I see lot of these; could it be related?

!ENTRY org.eclipse.ui 4 0 2014-02-10 14:56:54.094
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: Comparison method violates its general contract!)
        at org.eclipse.swt.SWT.error(SWT.java:4419)
        at org.eclipse.swt.SWT.error(SWT.java:4334)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3746)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3394)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1122)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:146)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:565)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:125)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:109)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:80)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:372)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:226)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeHi(TimSort.java:868)
        at java.util.TimSort.mergeAt(TimSort.java:485)
        at java.util.TimSort.mergeCollapse(TimSort.java:410)
        at java.util.TimSort.sort(TimSort.java:214)
        at java.util.TimSort.sort(TimSort.java:173)
        at java.util.Arrays.sort(Arrays.java:659)
        at org.eclipse.jface.viewers.TreePathViewerSorter.sort(TreePathViewerSorter.java:103)
        at org.eclipse.jface.viewers.AbstractTreeViewer.getSortedChildren(AbstractTreeViewer.java:640)
        at org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:2665)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:1937)
        at org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(TreeViewer.java:749)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1912)
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1869)
        at org.eclipse.ui.navigator.CommonViewer.internalRefresh(CommonViewer.java:561)
        at org.eclipse.jface.viewers.StructuredViewer$8.run(StructuredViewer.java:1545)
        at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1452)
        at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:426)
        at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1413)
        at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1543)
        at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:568)
        at org.eclipse.ui.navigator.CommonViewer.refresh(CommonViewer.java:350)
        at org.eclipse.ui.navigator.CommonViewer.refresh(CommonViewer.java:510)
        at org.eclipse.jst.jee.ui.internal.navigator.JEE5ContentProvider$1.run(JEE5ContentProvider.java:145)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
        ... 24 more
Comment 4 Jari Juslin CLA 2014-02-10 08:06:45 EST
Switched the theme, we'll see how it goes.
Comment 5 Niraj Modi CLA 2014-02-12 01:26:01 EST
(In reply to Arun Thondapu from comment #2)
> Can you provide any steps that can be used to reproduce this crash?
> 
> This seems like a duplicate of bug 419729 which was also reported against
> Ubuntu 13.10. Can you please try the workaround mentioned there (change the
> GTK theme from oxygen to something else) and update whether that helps?
> 
> Niraj, can you please try this on your Ubuntu 13.10 VM after installing the
> Cinnamon desktop environment? Thanks!

I don't see eclipse crashing on Ubuntu13 with Cinnamon desktop environment.
Comment 6 Jari Juslin CLA 2014-02-19 07:33:04 EST
Unfortunately switching the theme did not fix this. Niraj, have you set any settings like GDK_NATIVE_WINDOWS or are you going with the defaults, too?
Comment 7 Arun Thondapu CLA 2014-02-19 09:28:57 EST
(In reply to Jari Juslin from comment #6)
> Unfortunately switching the theme did not fix this. Niraj, have you set any
> settings like GDK_NATIVE_WINDOWS or are you going with the defaults, too?

Thanks for the update! If I'm not wrong, you're using the Eclipse JEE version, which build exactly are you using? Can you try with one of the recent 4.4 N-build or I-build to confirm? Also, it would be great if you can test whether the crash happens with the plain Eclipse SDK too...
Comment 8 Jari Juslin CLA 2014-02-24 06:44:31 EST
I'm using JEE edition, yes. Currently I'm running this:
Version: Luna M5 Release
Build id: 20140130-1145

This might be a stupid question, but how do I disable the JEE part? My downloading a regular Eclipse and setting it up to a different directory?
Comment 9 Jari Juslin CLA 2014-02-24 06:45:17 EST
I also have actual core dumps now available, if those are of use. The earlier is only a JVM crash report, not an actual memory dump, ie. I mislabelled it.
Comment 10 Jari Juslin CLA 2014-02-25 07:40:08 EST
Update: Now I have seen two crashes today with same pattern: I'm pressing a shortcut on keyboard to bring up an in-place dialog, like "Quick fix" or "Refactor" and only shadow of the new dialog is drawn and JVM immediately starts dumping core.
Comment 11 Jari Juslin CLA 2014-03-05 04:45:16 EST
I tested with the standard edition Eclipse, ie. not the JEE variant, and the crash happens with it, too.
Comment 12 Jari Juslin CLA 2014-03-06 04:54:54 EST
I think I have found a workaround. After update to Luna I dropped all my custom parameters and went with the Eclipse default. This seems to have been a mistake. Now I found this: http://stackoverflow.com/questions/19452390/eclipse-menus-dont-show-up-after-upgrading-to-ubuntu-13-10

With UBUNTU_MENUPROXY=0 the crashes went away. Or, at least I haven't seen one yet.
Comment 13 Jari Juslin CLA 2014-03-11 04:29:13 EDT
The workaround didn't work in the end. I tried various values for GDK_NATIVE_WINDOWS and UBUNTU_MENUPROXY, to no avail.

After this I switched back to Kepler; it has many glitches related to working with Gnome, but it does not _crash_.
Comment 14 Marc-André Laperle CLA 2014-04-04 16:39:57 EDT
I can reproduce this 100% of the time. 
1. File, Import..., Existing Projects into Workspace.
2. Browse for a root directory (for example eclipse.platform.ui/bundles) click OK
3. Click Browse again, crash happens.

Ubuntu 13.10, GTK3 3.8.6-0ubuntu3.1
LIBOVERLAY_SCROLLBAR=0 UBUNTU_MENUPROXY=0
Comment 15 Marc-André Laperle CLA 2014-05-23 16:01:38 EDT
Jari, have you upgraded to Ubuntu 14.04? Could you try to reproduce the bug again if that's the case? Note that you need to explicitly set SWT_GTK3=1 environment variable to test it because it's disabled by default for that version of GTK. I can't reproduce this anymore in 14.04 but I can still reproduce it in 13.10 (in a VM this time) with Eclipse 4.4 I20140522-1330. I also can't reproduce the bug in 12.04. So it looks like the issue was fixed between 13.10 and 14.04 (in the GTK 3.8 to 3.10 upgrade?). Given that 13.10 is will be end of life in July, maybe it's not worth trying to fix the issue.
Comment 16 Hendy Irawan CLA 2014-05-27 08:17:11 EDT
Probably related to bug 425692
Comment 17 Hendy Irawan CLA 2014-05-27 08:24:42 EDT
SWT_GTK3=0 (with or without GDK_NATIVE_WINDOWS=1) is a workaround that prevents the crash in Import Maven Project > Browse button for me.

SWT_GTK3=1 or leaving it out always triggers the crash.

....................................................................

ceefour@hendy:~/eclipse44rc2 > SWT_GTK3=1 GDK_NATIVE_WINDOWS=1 ./eclipse -debug
Start VM: /usr/bin/java
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp
-launcher /home/ceefour/eclipse44rc2/eclipse
-name Eclipse
--launcher.library /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744/eclipse_1605.so
-startup /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.appendVmargs
-exitdata 19b802c
-debug
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Install location:
    file:/home/ceefour/eclipse44rc2/
Configuration file:
    file:/home/ceefour/eclipse44rc2/configuration/config.ini loaded
Configuration location:
    file:/home/ceefour/eclipse44rc2/configuration/
Framework located:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
Loading extension: reference:file:org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
        eclipse.properties not found
Framework classpath:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
    file:/home/ceefour/eclipse44rc2/plugins/
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
Splash location:
    /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp

(java:8542): Gdk-WARNING **: The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.
See the documentation for gdk_window_ensure_native() on how to get native windows.
Debug options:
    file:/home/ceefour/eclipse44rc2/.options not found
Time to load bundles: 4
Starting application: 816
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
Application Started: 10055
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f45fa37daf6, pid=8542, tid=139939034519296
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgdk-3.so.0+0x32af6]  gdk_window_get_support_multidevice+0x16
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/ceefour/eclipse44rc2/hs_err_pid8542.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

....................................................................

ceefour@hendy:~/eclipse44rc2 > SWT_GTK3=0 GDK_NATIVE_WINDOWS=1 ./eclipse -debug
Start VM: /usr/bin/java
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp
-launcher /home/ceefour/eclipse44rc2/eclipse
-name Eclipse
--launcher.library /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744/eclipse_1605.so
-startup /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.appendVmargs
-exitdata 19e002c
-debug
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Install location:
    file:/home/ceefour/eclipse44rc2/
Configuration file:
    file:/home/ceefour/eclipse44rc2/configuration/config.ini loaded
Configuration location:
    file:/home/ceefour/eclipse44rc2/configuration/
Framework located:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
Loading extension: reference:file:org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
        eclipse.properties not found
Framework classpath:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
    file:/home/ceefour/eclipse44rc2/plugins/
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
Splash location:
    /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp
Debug options:
    file:/home/ceefour/eclipse44rc2/.options not found
Time to load bundles: 4
Starting application: 796
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
Application Started: 10185

....................................................................

ceefour@hendy:~/eclipse44rc2 > SWT_GTK3=0 ./eclipse -debug
Start VM: /usr/bin/java
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp
-launcher /home/ceefour/eclipse44rc2/eclipse
-name Eclipse
--launcher.library /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744/eclipse_1605.so
-startup /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.appendVmargs
-exitdata 1cf802c
-debug
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar /home/ceefour/eclipse44rc2//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Install location:
    file:/home/ceefour/eclipse44rc2/
Configuration file:
    file:/home/ceefour/eclipse44rc2/configuration/config.ini loaded
Configuration location:
    file:/home/ceefour/eclipse44rc2/configuration/
Framework located:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
Loading extension: reference:file:org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
        eclipse.properties not found
Framework classpath:
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi_3.10.0.v20140513-1456.jar
    file:/home/ceefour/eclipse44rc2/plugins/
    file:/home/ceefour/eclipse44rc2/plugins/org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar
Splash location:
    /home/ceefour/eclipse44rc2//plugins/org.eclipse.platform_4.4.0.v20140522-1330/splash.bmp
Debug options:
    file:/home/ceefour/eclipse44rc2/.options not found
Time to load bundles: 3
Starting application: 771
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
Application Started: 9954
Comment 18 Marc-André Laperle CLA 2014-05-27 09:33:39 EDT
Hendy, which version of GTK 3 do you have installed?
Comment 19 Hendy Irawan CLA 2014-05-28 00:41:36 EDT
GTK 3.8.6-0ubuntu3.1. This is same for both Ubuntu 13.10 and Linux Mint 16.

For comparison, Ubuntu 14.04 / Linux Mint 17 uses GTK 3.10.8-0ubuntu1.
Comment 20 Dani Megert CLA 2014-06-30 08:31:38 EDT
*** Bug 425692 has been marked as a duplicate of this bug. ***
Comment 21 Bauke Scholtz CLA 2014-07-17 07:59:02 EDT
I'm facing less or more the same problem with Luna 4.4 and JDK7/JDK8. I could consistently reproduce it by opening the Marketplace via Help menu.

On JDK7, the dump is as follows:

#  SIGSEGV (0xb) at pc=0x00007f74925d0fc5, pid=3004, tid=140141579847424
#
# JRE version: OpenJDK Runtime Environment (7.0_51) (build 1.7.0_51-b00)
# Java VM: OpenJDK 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libwebkitgtk-3.0.so.0+0x42cfc5]  webkit_web_view_get_dom_document+0x115


On JDK8, the dump is as follows:

#  SIGSEGV (0xb) at pc=0x00007f412d9bce9f, pid=3701, tid=139922969278208
#
# JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libgdk-x11-2.0.so.0+0x4ce9f]  gdk_display_open+0x3f


When executing Eclipse with SWT_GTK3=0, the problem went away.
Comment 22 Jari Juslin CLA 2014-07-17 08:14:55 EDT
Marc-Andre: I upgraded to Ubuntu 14.04 last week and switched back to Luna this week. This far no crashes, however I've been preoccupied outside Eclipse much of the time and now I'm leaving for vacation. I'll post an update in August when I know if the problem indeed got fixed or not.

So, let me recap: If the newer GTK fixed the issue, setting SWT_GTK3=1 should revert to the older one? So if the GTK version was the culprit, Luna should on 14.04 work with setting "0" and crash with setting "1"?
Comment 23 Marc-André Laperle CLA 2014-07-17 11:54:18 EDT
(In reply to Jari Juslin from comment #22)
> So, let me recap: If the newer GTK fixed the issue, setting SWT_GTK3=1
> should revert to the older one? So if the GTK version was the culprit, Luna
> should on 14.04 work with setting "0" and crash with setting "1"?

Not necessarily, from what I tested, this happens on GTK 3.8 but not 3.10 and up. Since 14.04 has 3.10.8, it shouldn't crash with SWT_GTK3=1 either. But on 14.04, I'm witnessing instead huge memory leaks when using GTK3 (bug 434895) so be aware of that! I'm still (on and off) investigating when and why the crash stopped happening on the GTK side. I did a git bisect on their repo but I could not isolate a single commit that fixed it. When I cherry-pick what I think is the commit from testing (it totaly looks unrelated to the crash) onto the GTK 3.8 branch, the crash still happens. So it looks like a group of commits fixed it. From what I debugged, it looks like some sort of memory stomp since a pointer to an object'class type is garbage, but not null. So there is the possibility that the bug in the GTK code is still there in newer GTK versions but not manifesting itself as this particular crash. I think that possibility makes it work investigating further.
Comment 24 Marc-André Laperle CLA 2014-07-18 10:26:42 EDT
(In reply to Bauke Scholtz from comment #21)
> I'm facing less or more the same problem with Luna 4.4 and JDK7/JDK8. I
> could consistently reproduce it by opening the Marketplace via Help menu.

Hi Bauke. Those crashes look different. If you could create a different bug with more information about your distribution and the versions of GTK3 and Webkitgtk installed that would be appreciated. Thanks!
Comment 25 Arun Thondapu CLA 2014-07-18 10:40:14 EDT
*** Bug 439879 has been marked as a duplicate of this bug. ***
Comment 26 Arun Thondapu CLA 2014-07-18 10:46:43 EDT
(In reply to Marc-Andre Laperle from comment #24)
> (In reply to Bauke Scholtz from comment #21)
> > I'm facing less or more the same problem with Luna 4.4 and JDK7/JDK8. I
> > could consistently reproduce it by opening the Marketplace via Help menu.
> 
> Hi Bauke. Those crashes look different. If you could create a different bug
> with more information about your distribution and the versions of GTK3 and
> Webkitgtk installed that would be appreciated. Thanks!

Bug 438598 seems to be the one for this problem...
Comment 27 Arun Thondapu CLA 2014-08-21 13:14:08 EDT
*** Bug 442192 has been marked as a duplicate of this bug. ***
Comment 28 Arun Thondapu CLA 2014-08-26 09:20:13 EDT
*** Bug 442518 has been marked as a duplicate of this bug. ***
Comment 29 Jari Juslin CLA 2014-08-29 03:27:27 EDT
After upgrading to Ubuntu 14.04 I have not seen this problem anymore. So upgrade to newer GTK fixed it for me.
Comment 30 Andreas Krügersen CLA 2014-09-29 10:27:30 EDT
I'm running on Ubuntu 14.04 with GTK 3.10.8-0ubuntu1.2 and I still have the same problem with SWT_GTK3=1 and UBUNTU_MENUPROXY=0. Apparently the upgrade alone doesn't fix it reliably.

Note that the crash address is different though.

Repro is also not reliable but when it happens it's almost always when opening the Open Resource dialog. Guess it could happen on every dialog though. I just happen to use that one very frequently.

Rarely happens also when building the project.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb6fc84d3, pid=16937, tid=3075450624
#
# JRE version: OpenJDK Runtime Environment (7.0_65-b32) (build 1.7.0_65-b32)
# Java VM: OpenJDK Client VM (24.65-b04 mixed mode, sharing linux-x86 )
# Derivative: IcedTea 2.5.2
# Distribution: Ubuntu 14.04 LTS, package 7u65-2.5.2-3~14.04
# Problematic frame:
# C  [libgdk-3.so.0+0x2e4d3]  gdk_window_get_support_multidevice+0x23
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/akruegersen/apps/eclipse/luna/hs_err_pid16937.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Comment 31 Dani Megert CLA 2014-11-14 04:14:38 EST
*** Bug 451426 has been marked as a duplicate of this bug. ***
Comment 32 Marc-André Laperle CLA 2014-11-17 13:24:47 EST
(In reply to Andreas Krügersen from comment #30)
> I'm running on Ubuntu 14.04 with GTK 3.10.8-0ubuntu1.2 and I still have the
> same problem with SWT_GTK3=1 and UBUNTU_MENUPROXY=0. Apparently the upgrade
> alone doesn't fix it reliably.

Hi Andreas. I haven't been able to reproduce the crash on 14.04 so far. Have you upgraded to Ubuntu 14.10 by any chance? I'm pretty sure that it won't crash with this version of GTK (3.12.2) because it includes this fix:
https://bugzilla.gnome.org/show_bug.cgi?id=726187
commit 40b6d90

In summary, Control.enableWindow (a GdkWindow) gets created when setEnabled(true) is called. On a GDK_ENTER_NOTIFY event, a GtkWidget stores this pointer (GdkWindow*) in a hash map (through _gtk_widget_set_device_window). When Control.setEnabled(false) is called, the GdkWindow is destroyed but the pointer is still in the GtkWidget hashmap. Then at some point the bad pointer is dereferenced and it crashes. With commit 40b6d90, _gtk_widget_set_device_window doesn't exist anymore so there can't be a dangling pointer. This commit was first released in 3.10.9 and Ubuntu 14.04 most likely still has the crash because it has GTK 3.10.8.

I have a hack that fixes the crash but I don't think this is the appropriate fix - at least until I know more. What I did is to disable both ENTER_NOTIFY and LEAVE_NOTIFY events on the GdkWindow and it doesn't crash anymore. The problem is, I don't know what Control.enableWindow is for and I looked at the commit and it only contains a bug number (bug 17346) which is not very helpful. I *think* maybe this is to still be able to process events when a control is disabled but I'm not sure. Any help would be appreciated!
Comment 33 Jonny Lamb CLA 2015-02-26 11:54:44 EST
Created attachment 251148 [details]
experimental workaround

(In reply to Marc-Andre Laperle from comment #32)
> Hi Andreas. I haven't been able to reproduce the crash on 14.04 so far. Have
> you upgraded to Ubuntu 14.10 by any chance? I'm pretty sure that it won't
> crash with this version of GTK (3.12.2) because it includes this fix:
> https://bugzilla.gnome.org/show_bug.cgi?id=726187
> commit 40b6d90
> 
> In summary, Control.enableWindow (a GdkWindow) gets created when
> setEnabled(true) is called. On a GDK_ENTER_NOTIFY event, a GtkWidget stores
             ^^^^
         you mean false here, right?

> this pointer (GdkWindow*) in a hash map (through
> _gtk_widget_set_device_window). When Control.setEnabled(false) is called,
> the GdkWindow is destroyed but the pointer is still in the GtkWidget
> hashmap. Then at some point the bad pointer is dereferenced and it crashes.
> With commit 40b6d90, _gtk_widget_set_device_window doesn't exist anymore so
> there can't be a dangling pointer. This commit was first released in 3.10.9
> and Ubuntu 14.04 most likely still has the crash because it has GTK 3.10.8.

Nice detective work!

So the idea now is to fix/workaround the bug in SWT even though it doesn't exist any longer in GTK, because people using older versions of GTK (read: Ubuntu 14.04 users) will still be hitting the bug?

> I have a hack that fixes the crash but I don't think this is the appropriate
> fix - at least until I know more. What I did is to disable both ENTER_NOTIFY
> and LEAVE_NOTIFY events on the GdkWindow and it doesn't crash anymore.

Two ideas come to mind:

1. Did you try creating a GDK_LEAVE_NOTIFY event yourself and emitting it on the widget, after having removed the GdkWindow? This looks like it should remove the dangling link. I'm not 100% sure what the side effects of such an event would be but perhaps a prioritized handler could be added before and removed right after to stop any said side effects?

    else if (device_window)
      {
        g_hash_table_remove (device_window, device);

        if (g_hash_table_size (device_window) == 0)
          g_object_set_qdata (G_OBJECT (widget), quark_pointer_window, NULL);
      }

2. SWT could "fix" the hash table manually. Given the nature of what the hash table is meant to include I reckon we could just get rid of it altogether. Because it's stored as "GObject data" it can be accessed anywhere easily. This isn't a particularly elegant workaround but is easy to implement and is self-contained. I've attached a patch which I haven't tested against an older GTK. Let me know what you think.

> The problem is, I don't know what Control.enableWindow is for and I looked
> at the commit and it only contains a bug number (bug 17346) which is not
> very helpful. I *think* maybe this is to still be able to process events
> when a control is disabled but I'm not sure. Any help would be appreciated!

I feel like playing with Control.enableWindow will cause a regression elsewhere and given there's little current information about why it was added, I reckon touching it should probably avoided for now.
Comment 34 Marc-André Laperle CLA 2015-02-26 13:34:20 EST
Created attachment 251150 [details]
Notify mask workaround

(In reply to Jonny Lamb from comment #33)
> Created attachment 251148 [details]
> experimental workaround
> 
> (In reply to Marc-Andre Laperle from comment #32)
> > In summary, Control.enableWindow (a GdkWindow) gets created when
> > setEnabled(true) is called. On a GDK_ENTER_NOTIFY event, a GtkWidget stores
>              ^^^^
>          you mean false here, right?

Hmm, yes!

> So the idea now is to fix/workaround the bug in SWT even though it doesn't
> exist any longer in GTK, because people using older versions of GTK (read:
> Ubuntu 14.04 users) will still be hitting the bug?

Yes exactly.

> > I have a hack that fixes the crash but I don't think this is the appropriate
> > fix - at least until I know more. What I did is to disable both ENTER_NOTIFY
> > and LEAVE_NOTIFY events on the GdkWindow and it doesn't crash anymore.
> 
> Two ideas come to mind:
> 
> 1. Did you try creating a GDK_LEAVE_NOTIFY event yourself and emitting it on
> the widget, after having removed the GdkWindow? This looks like it should
> remove the dangling link. I'm not 100% sure what the side effects of such an
> event would be but perhaps a prioritized handler could be added before and
> removed right after to stop any said side effects?

I tried to set the GDK_ENTER_NOTIFY_MASK and OS.GDK_LEAVE_NOTIFY_MASK and it works but I'm concerned about side effects. Sorry I forgot to come back to it and attach the patch (attached now).

> 2. SWT could "fix" the hash table manually. Given the nature of what the
> hash table is meant to include I reckon we could just get rid of it
> altogether. Because it's stored as "GObject data" it can be accessed
> anywhere easily. This isn't a particularly elegant workaround but is easy to
> implement and is self-contained. I've attached a patch which I haven't
> tested against an older GTK. Let me know what you think.

That sounds like a good and safer fix. I'll give your patch a try!
Comment 35 Marc-André Laperle CLA 2015-02-27 00:38:48 EST
(In reply to Marc-Andre Laperle from comment #34)
> That sounds like a good and safer fix. I'll give your patch a try!

Unfortunately, I can reproduce the crash with the patch. I'm not sure why that's the case. I tested using GTK 3.8.6.
Comment 36 Jonny Lamb CLA 2015-02-27 02:03:46 EST
(In reply to Marc-Andre Laperle from comment #35)
> (In reply to Marc-Andre Laperle from comment #34)
> > That sounds like a good and safer fix. I'll give your patch a try!
> 
> Unfortunately, I can reproduce the crash with the patch. I'm not sure why
> that's the case. I tested using GTK 3.8.6.

Thanks for trying it out. Annoying that it didn't work. Are you building your own GTK then running some small program against it that calls Control.setEnabled(false) to test it? If so I'll do some primative debugging on why this hasn't worked.

Relatedly, is there any information on how to wrap other GLib/GTK functions or do I manually edit OS.java?
Comment 37 Andreas Krügersen CLA 2015-02-27 08:12:21 EST
(In reply to Marc-Andre Laperle from comment #32)
> Hi Andreas. I haven't been able to reproduce the crash on 14.04 so far. Have
> you upgraded to Ubuntu 14.10 by any chance? I'm pretty sure that it won't
> crash with this version of GTK (3.12.2) because it includes this fix:
> https://bugzilla.gnome.org/show_bug.cgi?id=726187
> commit 40b6d90
> 

Hi Marc,

sorry for the very late reply, we couldn't upgrade to Ubuntu 14.10 for quite some time due to some problems with graphics drivers. I updated some days ago and so far I have not reproduced the crash again. So it indeed seems to be fixed with the new GTK version.
Comment 38 Marc-André Laperle CLA 2015-02-27 10:25:02 EST
(In reply to Jonny Lamb from comment #36)
> (In reply to Marc-Andre Laperle from comment #35)
> > (In reply to Marc-Andre Laperle from comment #34)
> > > That sounds like a good and safer fix. I'll give your patch a try!
> > 
> > Unfortunately, I can reproduce the crash with the patch. I'm not sure why
> > that's the case. I tested using GTK 3.8.6.
> 
> Thanks for trying it out. Annoying that it didn't work. Are you building
> your own GTK then running some small program against it that calls
> Control.setEnabled(false) to test it? If so I'll do some primative debugging
> on why this hasn't worked.

I compiled my own GTK from git. I don't have a small program but I can reproduce it very consistently by doing the steps in comment 14.

> Relatedly, is there any information on how to wrap other GLib/GTK functions
> or do I manually edit OS.java?

The only documentation that I know is:
https://www.eclipse.org/swt/jnigen.php
Basically, you install SWT Tools and when you edit the java files, it should modify the C files automatically.
Comment 39 Eclipse Genie CLA 2015-03-04 08:53:31 EST
New Gerrit change created: https://git.eclipse.org/r/43156
Comment 40 Jonny Lamb CLA 2015-03-04 08:56:40 EST
This bug was so much more involved than I was expecting. My previous patch didn't work because it made a poor assumption about what widget would be holding a reference to the GdkWindow.

I just uploaded a patch:

(In reply to Eclipse Genie from comment #39)
> New Gerrit change created: https://git.eclipse.org/r/43156
Comment 41 Marc-André Laperle CLA 2015-03-18 01:21:41 EDT
Created attachment 251680 [details]
Sample program

I have made a reproducible example. I can reproduce the crash 100% of the time with GTK 3.8.9. Simply put your cursor on the button and wait a few seconds.
Comment 42 Alexander Kurtakov CLA 2015-03-19 17:02:48 EDT
I have ammended the patch with what I think needs to be done. Testing is welcome.
And would someone please test the patch on 32 bit machine as it wouldn't have even compiled previously.
Comment 43 Marc-André Laperle CLA 2015-03-19 17:04:19 EDT
(In reply to Alexander Kurtakov from comment #42)
> I have ammended the patch with what I think needs to be done. Testing is
> welcome.
> And would someone please test the patch on 32 bit machine as it wouldn't
> have even compiled previously.

Thanks! I'll test both 32 and 64.
Comment 44 Marc-André Laperle CLA 2015-03-20 02:04:26 EDT
(In reply to Alexander Kurtakov from comment #42)
> I have ammended the patch with what I think needs to be done. Testing is
> welcome.
> And would someone please test the patch on 32 bit machine as it wouldn't
> have even compiled previously.

I compiled and ran the patch on both 32 bit and 64 bit successfully.
Comment 45 Alexander Kurtakov CLA 2015-03-20 02:38:35 EDT
It works for me too so I'll push once M7 is open for development.
Comment 47 Alexander Kurtakov CLA 2015-03-24 04:51:29 EDT
In master now.
Comment 48 Marc-André Laperle CLA 2015-03-24 10:10:26 EDT
(In reply to Alexander Kurtakov from comment #47)
> In master now.

Thanks a lot Alexander and Jonny! That was good team work! :)
Comment 49 Eclipse Genie CLA 2015-03-26 16:40:06 EDT
New Gerrit change created: https://git.eclipse.org/r/44711
Comment 50 Marc-André Laperle CLA 2015-03-27 16:29:07 EDT
There seems to be an issue with this patch on Ubuntu 14.04 (works on 14.10), see 463328.
Comment 51 Marc-André Laperle CLA 2015-03-27 16:54:07 EDT
(In reply to Marc-Andre Laperle from comment #50)
> There seems to be an issue with this patch on Ubuntu 14.04 (works on 14.10),
> see 463328.

bug 463328 (missing link).