GTK3/GLIB hangs random hangs on g_hash_table_insert

I’ve encountered random GTK/GLIB hangs. This is gdb stack trace of my thread running at 100% cpu:

0x00007f00df43c950 in g_hash_table_insert () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007f00df43c950 in g_hash_table_insert () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f01143f3909 in gdk_event_new () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#2  0x00007f0114426099 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#3  0x00007f01143eba79 in gdk_display_get_event () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#4  0x00007f0114426546 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#5  0x00007f00df44e569 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007f00df4a3298 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007f00df44bd20 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007f00dfa0b655 in gtk_main_iteration_do () from /lib/x86_64-linux-gnu/libgtk-3.so.0
#9  0x00007f0114520200 in Java_org_eclipse_swt_internal_gtk3_GTK3_gtk_1main_1iteration_1do () from /usr/lib/jni/libswt-pi3-gtk-4944r26.so

Does anyone have similar problems? Is there a way to avoid it?
Iam using following libs:

ii  libgtk-3-0:amd64                         3.24.34-3ubuntu2.1                      amd64        GTK graphical user interface library
ii  libgtk-3-bin                             3.24.34-3ubuntu2.1                      amd64        programs for the GTK graphical user interface library
ii  libgtk-3-common                          3.24.34-3ubuntu2.1                      all          common files for the GTK graphical user interface library
ii  libglib2.0-0:amd64                       2.74.1-2                                amd64        GLib library of C routines
ii  libglib2.0-bin                           2.74.1-2                                amd64        Programs for the GLib library
ii  libglib2.0-data                          2.74.1-2                                all          Common files for GLib library

Are you sure it’s hanging and not just repeatedly calling the same function again and again? That’s a really weird place to have a hang. Could your application be dealing with constant incoming events? Maybe some code injecting events improperly?

Installing debug symbols for GTK would be a good next step to show a few more frames of what is going on.

Also, I would do a thread apply all bt and make sure you don’t see GTK being used on any other thread. The thread where Java initialized GTK is the only thread that you can use it on.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.