GNOME Bugzilla – Bug 637132
Programs crashing due to Gdk-CRITICAL "assertion `GDK_IS_WINDOW (window)' failed"
Last modified: 2010-12-21 16:34:12 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
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
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
+ Trace 225103
Thread 8 (Thread 0x7fffa90f4700 (LWP 8999))
AfC
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:
+ Trace 225104
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
+ Trace 225105
This may be related to a similar problem GTKmm is having; see bug #606903 AfC
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
Ok, probable cause is our override implementing for Widget's getWindow() doesn't call bindings_java_memory_cleanup() like it ought to have. AfC
The problem is fixed with the following patch. http://paste.pocoo.org/show/307817/ Quill does not crash anymore for me.
Ok. fix merged to 'mainline', revno 776. AfC