After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637132 - Programs crashing due to Gdk-CRITICAL "assertion `GDK_IS_WINDOW (window)' failed"
Programs crashing due to Gdk-CRITICAL "assertion `GDK_IS_WINDOW (window)' fai...
Status: RESOLVED FIXED
Product: java-gnome
Classification: Bindings
Component: GTK
mainline
Other Linux
: Urgent critical
: ---
Assigned To: java-gnome bindings maintainers
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-12-13 09:02 UTC by Andrew Cowie
Modified: 2010-12-21 16:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Java program to demonstrate crash (2.80 KB, application/octet-stream)
2010-12-20 13:52 UTC, Andrew Cowie
Details

Description Andrew Cowie 2010-12-13 09:02:28 UTC
java-gnome programs are crashing

org.gnome.glib.FatalError: Gdk-CRITICAL
IA__gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed
	at org.gnome.gtk.GtkContainer.gtk_container_remove(Native Method)
	at org.gnome.gtk.GtkContainer.remove(GtkContainer.java:112)
	at org.gnome.gtk.Container.remove(Container.java:121)
	at quill.ui.ComponentEditorWidget.initializeSeries(ComponentEditorWidget.java:204)
	at quill.ui.PrimaryWindow.handleComponentNext(PrimaryWindow.java:1091)
	at quill.ui.PrimaryWindow.access$3(PrimaryWindow.java:1077)
	at quill.ui.PrimaryWindow$2.onKeyPressEvent(PrimaryWindow.java:497)
	at org.gnome.gtk.GtkWidget.receiveKeyPressEvent(GtkWidget.java:2970)
	at org.gnome.gtk.GtkMain.gtk_main(Native Method)
	at org.gnome.gtk.GtkMain.main(GtkMain.java:82)
	at org.gnome.gtk.Gtk.main(Gtk.java:119)
	at quill.client.Quill.runUserInterface(Quill.java:127)
	at quill.client.Quill.main(Quill.java:48)

That's synchronous; just as often we're seeing:

org.gnome.glib.FatalError: Gdk-CRITICAL
IA__gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed
	at org.gnome.gtk.GtkMain.gtk_main(Native Method)
	at org.gnome.gtk.GtkMain.main(GtkMain.java:82)
	at org.gnome.gtk.Gtk.main(Gtk.java:119)
	at quill.client.Quill.runUserInterface(Quill.java:127)
	at quill.client.Quill.main(Quill.java:48)

which is far worse because it's happening in another thread [which raises perhaps another issue; we're not seeing that Exception until something crosses the JNI boundary and returns to Java; that's a side effect of our trapping log messages]

I have only managed to obtain a paltry collection of full stack traces with GDB; I will attach them to this bug. I a few observations: the bug is definitely happening after we g_object_remove_toggle_ref(), and this often seems correlated with gtk_widget_remove().

I don't have a way to replicate this bug except with Quill, and it is sporadic: run Quill on a document with multiple chapters, then cycle around between chapters while adding new segments to those chapters and typing. Sooner or later it'll go down.

The last internals problem we had (and fixed in java-gnome 4.0.17) was related to TextViews and their idle rendering behaviour; Quill is TextView heavy and perhaps that is again a factor here.

AfC
Comment 1 Andrew Cowie 2010-12-13 09:10:41 UTC
The first stack trace I manged to get wasn't with GDB but actually by putting a call to glibc's backtrace() and backtrace_symbols_fd() into src/jni/bindings_java_util.c when the logging handler gets hit.

worthil ~/workspace/quill $ ./quill doc/format/ParchmentFileFormat.parchment 
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1831)[0x7ffcaca24831]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1c99)[0x7ffcaca24c99]
/lib/libglib-2.0.so.0(g_logv+0x1b9)[0x7ffca4a55b89]
/lib/libglib-2.0.so.0(g_log+0x83)[0x7ffca4a55fa3]
/usr/lib/libgdk-x11-2.0.so.0(+0x45891)[0x7ffca6cf5891]
/usr/lib/libgobject-2.0.so.0(g_object_unref+0x174)[0x7ffca5311e14]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(bindings_java_memory_unref+0x24)[0x7ffcaca26579]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(Java_org_gnome_glib_GObject_g_1object_1remove_1toggle_1ref+0x28)[0x7ffcaca707b7]
[0x7ffcf64eec88]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1831)[0x7ffcaca24831]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1c99)[0x7ffcaca24c99]
/lib/libglib-2.0.so.0(g_logv+0x1b9)[0x7ffca4a55b89]
/lib/libglib-2.0.so.0(g_log+0x83)[0x7ffca4a55fa3]
/usr/lib/libgtk-x11-2.0.so.0(+0x25f370)[0x7ffca71be370]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x24a30)[0x7ffca5325a30]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unrealize+0xb7)[0x7ffca71b8e07]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unparent+0x438)[0x7ffca71bf0f8]
/usr/lib/libgtk-x11-2.0.so.0(+0x85155)[0x7ffca6fe4155]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x246b1)[0x7ffca53256b1]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(Java_org_gnome_gtk_GtkContainer_gtk_1container_1remove+0x3b)[0x7ffcaca286ae]
[0x7ffcf64eec88]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1831)[0x7ffcaca24831]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1c99)[0x7ffcaca24c99]
/lib/libglib-2.0.so.0(g_logv+0x1b9)[0x7ffca4a55b89]
/lib/libglib-2.0.so.0(g_log+0x83)[0x7ffca4a55fa3]
/usr/lib/libgtk-x11-2.0.so.0(+0x25f33b)[0x7ffca71be33b]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x24a30)[0x7ffca5325a30]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unrealize+0xb7)[0x7ffca71b8e07]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unparent+0x438)[0x7ffca71bf0f8]
/usr/lib/libgtk-x11-2.0.so.0(+0x85155)[0x7ffca6fe4155]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x246b1)[0x7ffca53256b1]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(Java_org_gnome_gtk_GtkContainer_gtk_1container_1remove+0x3b)[0x7ffcaca286ae]
[0x7ffcf64eec88]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1831)[0x7ffcaca24831]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1c99)[0x7ffcaca24c99]
/lib/libglib-2.0.so.0(g_logv+0x1b9)[0x7ffca4a55b89]
/lib/libglib-2.0.so.0(g_log+0x83)[0x7ffca4a55fa3]
/usr/lib/libgdk-x11-2.0.so.0(gdk_window_destroy+0xf)[0x7ffca6cf583f]
/usr/lib/libgtk-x11-2.0.so.0(+0x25f344)[0x7ffca71be344]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x24a30)[0x7ffca5325a30]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unrealize+0xb7)[0x7ffca71b8e07]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unparent+0x438)[0x7ffca71bf0f8]
/usr/lib/libgtk-x11-2.0.so.0(+0x85155)[0x7ffca6fe4155]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x246b1)[0x7ffca53256b1]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(Java_org_gnome_gtk_GtkContainer_gtk_1container_1remove+0x3b)[0x7ffcaca286ae]
[0x7ffcf64eec88]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1831)[0x7ffcaca24831]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(+0xb1c99)[0x7ffcaca24c99]
/lib/libglib-2.0.so.0(g_logv+0x1b9)[0x7ffca4a55b89]
/lib/libglib-2.0.so.0(g_log+0x83)[0x7ffca4a55fa3]
/usr/lib/libgtk-x11-2.0.so.0(+0x25f344)[0x7ffca71be344]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x24a30)[0x7ffca5325a30]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unrealize+0xb7)[0x7ffca71b8e07]
/usr/lib/libgtk-x11-2.0.so.0(gtk_widget_unparent+0x438)[0x7ffca71bf0f8]
/usr/lib/libgtk-x11-2.0.so.0(+0x85155)[0x7ffca6fe4155]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e)[0x7ffca530fa6e]
/usr/lib/libgobject-2.0.so.0(+0x246b1)[0x7ffca53256b1]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6)[0x7ffca53272a6]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7ffca5327863]
/home/andrew/workspace/java-gnome/tmp/libgtkjni-4.0.18-dev.so(Java_org_gnome_gtk_GtkContainer_gtk_1container_1remove+0x3b)[0x7ffcaca286ae]
[0x7ffcf64eec88]
org.gnome.glib.FatalError: Gdk-CRITICAL
IA__gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed
	at org.gnome.gtk.GtkContainer.gtk_container_remove(Native Method)
	at org.gnome.gtk.GtkContainer.remove(GtkContainer.java:112)
	at org.gnome.gtk.Container.remove(Container.java:121)
	at quill.ui.ComponentEditorWidget.initializeSeries(ComponentEditorWidget.java:204)
	at quill.ui.PrimaryWindow.handleComponentNext(PrimaryWindow.java:1091)
	at quill.ui.PrimaryWindow.access$3(PrimaryWindow.java:1077)
	at quill.ui.PrimaryWindow$2.onKeyPressEvent(PrimaryWindow.java:497)
	at org.gnome.gtk.GtkWidget.receiveKeyPressEvent(GtkWidget.java:2970)
	at org.gnome.gtk.GtkMain.gtk_main(Native Method)
	at org.gnome.gtk.GtkMain.main(GtkMain.java:82)
	at org.gnome.gtk.Gtk.main(Gtk.java:119)
	at quill.client.Quill.runUserInterface(Quill.java:127)
	at quill.client.Quill.main(Quill.java:48)
Attempting emergency save... 
/home/andrew/workspace/quill/doc/format/Background.xml.RESCUED
/home/andrew/workspace/quill/doc/format/Chapters.xml.RESCUED
/home/andrew/workspace/quill/doc/format/Documents.xml.RESCUED
/home/andrew/workspace/quill/doc/format/Notes.xml.RESCUED
Done.
worthil ~/workspace/quill $ 

This is the first trace from above. It does not appear from the garbage collector (though as noted above, we may be getting misled about that), so the fact that g_object_remove_toggle_ref() is getting hit is quite remarkable.

AfC
Comment 2 Andrew Cowie 2010-12-13 09:17:19 UTC
Running the program in GDB with quill-debug containing:

#!/bin/bash
source .config

exec gdb --quiet -ex "run" --args /usr/lib/jvm/java-6-openjdk/bin/java -client -ea -Djava.awt.headless=true \
	-classpath ${GNOME_JARS}:${XOM_JARS}:${JUNIT_JARS}:tmp/classes/ \
	quill.client.Quill $*


as discussed in http://blogs.operationaldynamics.com/andrew/software/free-java/get-java-to-coredump.html 

I got something new. While I managed to get a GDB stack trace corresponding to the code path that leads to the Gdk-CRITICAL IA__gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed that is the visible signature of this crash, *before* that I saw the following!


Breakpoint 4, bindings_java_logging_handler (log_domain=0x7fffa2c25833 "Gdk", log_level=G_LOG_LEVEL_WARNING, 
    message=0x5d99bc0 "losing last reference to undestroyed window\n", user_data=0x0) at src/jni/bindings_java_util.c:364
364		env = bindings_java_getEnv();
(gdb) 
(gdb) bt

Thread 8 (Thread 0x7fffa90f4700 (LWP 8999))

  • #0 sem_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S line 86
  • #1 check_pending_signals
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/os/linux/vm/os_linux.cpp line 2322
  • #2 signal_thread_entry
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/share/vm/runtime/os.cpp line 184
  • #3 JavaThread::thread_main_inner
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/share/vm/runtime/thread.cpp line 1428
  • #4 java_start
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/os/linux/vm/os_linux.cpp line 795
  • #5 start_thread
    at pthread_create.c line 304
  • #6 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #7 ??

AfC
Comment 3 Andrew Cowie 2010-12-13 09:19:57 UTC
That's annoying. Bugzilla swolloed my text in the stack trace. And don't bother with the expander there.

What the hell is "losing last reference to undestroyed window\n" ?

It'd be nice if we knew which thread that was. I'd say GC, but that's just a guess. It's not main. Try again:

  • #0 bindings_java_logging_handler
    at src/jni/bindings_java_util.c line 364
  • #1 g_logv
    at /build/buildd/glib2.0-2.26.1/glib/gmessages.c line 527
  • #2 g_log
    at /build/buildd/glib2.0-2.26.1/glib/gmessages.c line 577
  • #3 gdk_window_finalize
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkwindow.c line 595
  • #4 g_object_unref
    at /build/buildd/glib2.0-2.26.1/gobject/gobject.c line 2712
  • #5 bindings_java_memory_unref
    at src/jni/bindings_java_memory.c line 216
  • #6 Java_org_gnome_glib_GObject_g_1object_1remove_1toggle_1ref
    at src/bindings/org/gnome/glib/GObject.c line 301
  • #7 ??
  • #8 ??
  • #9 ??
  • #10 ??
  • #11 ??
  • #12 ??

AfC
Comment 4 Andrew Cowie 2010-12-13 09:22:35 UTC
So, that happens (and if I had to guess, I'd say that's root cause). Then the CRITICAL happens and the program thunders in. The really charming bit is watching TreeViews vanish from the editor just before. 

Full trace at the CRITICAL is here, in Thread 2:

(gdb) thread apply all bt

Thread 8 (Thread 0x7fffa90f4700 (LWP 8999))

  • #0 sem_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S line 86
  • #1 check_pending_signals
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/os/linux/vm/os_linux.cpp line 2322
  • #2 signal_thread_entry
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/share/vm/runtime/os.cpp line 184
  • #3 JavaThread::thread_main_inner
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/share/vm/runtime/thread.cpp line 1428
  • #4 java_start
    at /build/buildd/openjdk-6-6b20-1.9.2/build/openjdk/hotspot/src/os/linux/vm/os_linux.cpp line 795
  • #5 start_thread
    at pthread_create.c line 304
  • #6 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #7 ??

AfC
Comment 5 Andrew Cowie 2010-12-13 09:23:24 UTC
This may be related to a similar problem GTKmm is having; see bug #606903 

AfC
Comment 6 Andrew Cowie 2010-12-20 13:52:52 UTC
Created attachment 176762 [details]
Java program to demonstrate crash

This small program fires up a thread and in that thread creates and removes Widgets from a top level Window. The catch is that it has to be something that creates its own [gdk] Window, so interestingly a Label doesn't work.

AfC
Comment 7 Andrew Cowie 2010-12-21 11:10:43 UTC
Ok, probable cause is our override implementing for Widget's getWindow() doesn't call bindings_java_memory_cleanup() like it ought to have.

AfC
Comment 8 Guillaume Mazoyer 2010-12-21 15:07:20 UTC
The problem is fixed with the following patch.
http://paste.pocoo.org/show/307817/
Quill does not crash anymore for me.
Comment 9 Andrew Cowie 2010-12-21 16:34:12 UTC
Ok. fix merged to 'mainline', revno 776.

AfC