Bug 463102 - AllBrowserTests killed by timeout - hangs at OS.GTK_TYPE_FIXED at Display.createDisplay
Summary: AllBrowserTests killed by timeout - hangs at OS.GTK_TYPE_FIXED at Display.cre...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 critical (vote)
Target Milestone: 4.5 M7   Edit
Assignee: Marc-André Laperle CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 427776
Blocks:
  Show dependency tree
 
Reported: 2015-03-25 10:51 EDT by Markus Keller CLA
Modified: 2015-04-08 10:34 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2015-03-25 10:51:18 EDT
In N20150324-2000 and I20150324-0800, the AllBrowserTests didn't finish and were killed by a timeout.

The test was apparently hanging here:

[java] java.lang.Exception: main
[java] 	at org.eclipse.swt.internal.gtk.OS._GTK_TYPE_FIXED(Native Method)
[java] 	at org.eclipse.swt.internal.gtk.OS.GTK_TYPE_FIXED(OS.java:1689)
[java] 	at org.eclipse.swt.widgets.Display.createDisplay(Display.java:967)


Extract from http://download.eclipse.org/eclipse/downloads/drops4/I20150324-0800/testresults/consolelogs/linux.gtk.x86_64_8.0_consolelog.txt :

java-test:
     [echo] Running org.eclipse.swt.tests.junit.AllBrowserTests. Result file: /opt/users/hudsonbuild/workspace/ep45I-unit-lin64/workarea/I20150324-0800/eclipse-testing/results/linux.gtk.x86_64_8.0/org.eclipse.swt.tests.junit.AllBrowserTests.xml
     [echo] timout property: 900000
[...]
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: gtype.c:2475: initialization assertion failed, use IA__g_type_init() prior to this function
     [java] 
     [java] (process:17655): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: gtype.c:2475: initialization assertion failed, use IA__g_type_init() prior to this function
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: gtype.c:2475: initialization assertion failed, use IA__g_type_init() prior to this function
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: gtype.c:2475: initialization assertion failed, use IA__g_type_init() prior to this function
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: gtype.c:2475: initialization assertion failed, use IA__g_type_init() prior to this function
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
     [java] 
     [java] (process:17655): GLib-GObject-CRITICAL **: g_signal_lookup: assertion `G_TYPE_IS_INSTANTIATABLE (itype) || G_TYPE_IS_INTERFACE (itype)' failed
     [java] Xlib:  extension "RANDR" missing on display ":100.0".
     [java] EclipseTestRunner almost reached timeout '900000'.
[...]
     [java] Thread dump 0 at 2015-03-24 11:11:28 -0400:
[...]
     [java] java.lang.Exception: main
     [java] 	at org.eclipse.swt.internal.gtk.OS._GTK_TYPE_FIXED(Native Method)
     [java] 	at org.eclipse.swt.internal.gtk.OS.GTK_TYPE_FIXED(OS.java:1689)
     [java] 	at org.eclipse.swt.widgets.Display.createDisplay(Display.java:967)
     [java] 	at org.eclipse.swt.widgets.Display.create(Display.java:917)
     [java] 	at org.eclipse.swt.graphics.Device.<init>(Device.java:156)
     [java] 	at org.eclipse.swt.widgets.Display.<init>(Display.java:513)
     [java] 	at org.eclipse.swt.widgets.Display.<init>(Display.java:504)
     [java] 	at org.eclipse.swt.widgets.Display.getDefault(Display.java:1721)
     [java] 	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:264)
     [java] 	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:257)
     [java] 	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:208)
     [java] 	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:144)
     [java] 	at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget.setUp(Test_org_eclipse_swt_widgets_Widget.java:41)
     [java] 	at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Composite.setUp(Test_org_eclipse_swt_widgets_Composite.java:38)
     [java] 	at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.setUp(Test_org_eclipse_swt_browser_Browser.java:43)
     [java] 	at junit.framework.TestCase.runBare(TestCase.java:139)
[...]
[...]
     [java] Timeout: killed the sub-process

collect-results:
[junitreport] the file /opt/users/hudsonbuild/workspace/ep45I-unit-lin64/workarea/I20150324-0800/eclipse-testing/test-eclipse/eclipse/org.eclipse.swt.tests.junit.AllBrowserTests.xml is empty.
[junitreport] This can be caused by the test JVM exiting unexpectedly
Comment 1 Markus Keller CLA 2015-03-25 10:58:06 EDT
If you wonder why you didn't see a test failure in the build, see bug 423561 comment 46. It's basically due to bug 210792.
Comment 2 Markus Keller CLA 2015-03-25 11:12:01 EDT
When I try to run AllBrowserTests in my workspace, it hangs already a few lines earlier in OS.gtk_init_check(..):

OS._gtk_init_check(int[], int[]) line: not available [native method]	
OS.gtk_init_check(int[], int[]) line: 8863	
Display.createDisplay(DeviceData) line: 932
Comment 3 Leo Ufimtsev CLA 2015-03-25 11:43:50 EDT
Is this gtk2/gtk3 specific? 

I haven't looked into this too deeply. When I run the tests (Gtk2|Gtk3) then they do seem to pass (somewhat slowly, but eventually they pass). 

Fedora 21. Gtk-3.14/Gtk-2.24

Do the tests actually fail for you?
Comment 4 Markus Keller CLA 2015-03-26 09:18:20 EDT
(In reply to Leo Ufimtsev from comment #3)
> Is this gtk2/gtk3 specific? 

No, comment 2 happens with GTK2 (2.24.10) and GTK3 (3.4.2) on Ubuntu 12.04 32-bit. Running this is enough to reproduce:

	public static void main(String[] args) {
		new org.eclipse.swt.widgets.Shell();
	}

On the Hudson test machine, the GTK version is 2.18.9.
Comment 5 Markus Keller CLA 2015-03-26 09:38:26 EDT
Comment 4 passes locally when I check out I20150320-0030 or the commit before bug 427776 comment 46: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e9c202445b7800e816318f00aed3887885c67efd

After that commit, it hangs.
Comment 6 Alexander Kurtakov CLA 2015-03-26 09:55:15 EDT
Markus, just to be sure - this problem with GTK_TYPE_FIXED happens on both GTK 2 and 3? I ask because GTK_TYPE_FIXED is not called on GTK 3 AFAICS.
Comment 7 Markus Keller CLA 2015-03-26 10:05:31 EDT
(In reply to Alexander Kurtakov from comment #6)
> Markus, just to be sure - this problem with GTK_TYPE_FIXED happens on both
> GTK 2 and 3? I ask because GTK_TYPE_FIXED is not called on GTK 3 AFAICS.

The hang in _GTK_TYPE_FIXED only happens on the test machine, which currently only runs GTK 2.


In my workspace, the call to "OS.GTK_TYPE_WIDGET ()" in Control's new static initializer block writes the messages below to stderr. Note that the problem still happens when I call Display.getCurrent() before new Shell(), but it doesn't happen any more when I call Display.getDefault() or new Display().

=> Looks like the static initializer just runs too early.


(process:6857): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()

(process:6857): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed

(process:6857): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()

(process:6857): GLib-GObject-WARNING **: cannot add class private field to invalid type '<invalid>'

(process:6857): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()

(process:6857): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6857): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()

(process:6857): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed

(process:6857): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed

(process:6857): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
Comment 8 Marc-André Laperle CLA 2015-03-26 16:41:38 EDT
I could reproduce this on Ubuntu 12.04. I moved the initialization code to createWidget. I don't know if this could be done earlier but it fixes the problem for me. I also made sure that the crash that this code fixes hasn't come back.

https://git.eclipse.org/r/#/c/44711/
Comment 9 Alexander Kurtakov CLA 2015-03-30 08:39:46 EDT
(In reply to Marc-Andre Laperle from comment #8)
> I could reproduce this on Ubuntu 12.04. I moved the initialization code to
> createWidget. I don't know if this could be done earlier but it fixes the
> problem for me. I also made sure that the crash that this code fixes hasn't
> come back.
> 
> https://git.eclipse.org/r/#/c/44711/

With this patch I get "(process:5556): GLib-GObject-WARNING **: gsignal.c:1189: unable to lookup signal "enter-notify-event" of unloaded type 'GtkWidget' " when rnning AllBrowserTests on console but the tests succeed. Would you please look into fixing it?
Comment 11 Markus Keller CLA 2015-03-30 10:02:02 EDT
(In reply to Alexander Kurtakov from comment #9)
For me, on Ubuntu 12.04, AllBrowserTests also succeeds, but without printing anything to the console (except for the "Browser#setUp():" progress messages).
Comment 12 Alexander Kurtakov CLA 2015-03-30 11:18:43 EDT
Markus, Mark-Andre, so this happens on Fedora 22 with GTK 3.16 and GLib 2.44. The fix I think is version guarding the callback creation like the other parts of the patch, it's not used on other versions.
Comment 13 Eclipse Genie CLA 2015-03-30 12:09:04 EDT
New Gerrit change created: https://git.eclipse.org/r/44861
Comment 14 Alexander Kurtakov CLA 2015-03-30 12:10:42 EDT
I would welcome testing for my patch though it's supposed to be straightforward.
Comment 15 Eclipse Genie CLA 2015-03-31 12:45:09 EDT
New Gerrit change created: https://git.eclipse.org/r/44933
Comment 17 Alexander Kurtakov CLA 2015-04-02 07:54:17 EDT
Thanks, Mark-Andre,
with your patch warning is gone for me. Pushed to master.
Comment 18 Markus Keller CLA 2015-04-07 06:53:22 EDT
Reopening to address Marc-Andre's comment in https://git.eclipse.org/r/#/c/44933/
> you didn't want us to add the version check here? I left it out to make it easier for you to test.

And my comment in https://git.eclipse.org/r/#/c/44861/

> Looks good, but I'd also avoid some code duplication and replace the two old occurrences of
>    if (OS.GTK3 && OS.GTK_VERSION < OS.VERSION (3, 11, 9))
> with
>    if (enterNotifyEventFunc != null)
Comment 19 Arun Thondapu CLA 2015-04-08 10:34:11 EDT
(In reply to Markus Keller from comment #18)
> Reopening to address Marc-Andre's comment in
> https://git.eclipse.org/r/#/c/44933/
> > you didn't want us to add the version check here? I left it out to make it easier for you to test.
> 
> And my comment in https://git.eclipse.org/r/#/c/44861/
> 
> > Looks good, but I'd also avoid some code duplication and replace the two old occurrences of
> >    if (OS.GTK3 && OS.GTK_VERSION < OS.VERSION (3, 11, 9))
> > with
> >    if (enterNotifyEventFunc != null)

Fixed via http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5b490bb962a97813a4885b327f855701a501fd7e