pull-request: trip handling

Dirk Hohndel dirk at hohndel.org
Tue Sep 4 19:28:30 PDT 2012


On Sep 4, 2012, at 7:11 AM, Dirk Hohndel wrote:

> 
> On Sep 3, 2012, at 11:12 PM, Henrik Brautaset Aronsen wrote:
> 
>> Den 04.09.12 07:14, skrev Miika Turkia:
>>> On Tue, Sep 4, 2012 at 7:47 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>>>>> I am getting a crash whenever I import an XML dive file.
>>>>> - ./subsurface dives/test23.xml
>>>>> - Import dives/test22.xml
>>>> Wow - I've never used that feature like this. The file selector dialog sucks as it doesn't default to a sane directory.
>>>> This crashes on my Mac with some pthreads problem, but seems to work just fine on Linux.
>>> I get this crash on Ubuntu 12.04
>>> GLib (gthread-posix.c): Unexpected error from C library during
>>> 'pthread_setspecific': Invalid argument.  Aborting.
>> 
>> Yup, same here on MacOSX 10.8.1:
> 
> I tried this a few dozen times. Yes, I can crash it on my Mac, no, I can't get a useful backtrace in any of the threads :-(
> 
>> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>> 0   libsystem_kernel.dylib            0x00007fff9022e212 __pthread_kill + 10
>> 1   libsystem_c.dylib                 0x00007fff96597b34 pthread_kill + 90
>> 2   libsystem_c.dylib                 0x00007fff965dbdfa abort + 143
>> 3   libglib-2.0.0.dylib               0x000000010c504385 g_private_set + 85
>> 4   libglib-2.0.0.dylib               0x000000010c4e90ed g_thread_self + 61
>> 5   libglib-2.0.0.dylib               0x000000010c4c72fb g_source_attach + 187
>> 6   libglib-2.0.0.dylib               0x000000010c4c7682 g_idle_add_full + 242
>> 7   libgtk-quartz-2.0.0.dylib         0x000000010bca7f4b gtk_tree_view_row_deleted + 699
>> 8   libgobject-2.0.0.dylib            0x000000010c443104 g_closure_invoke + 308
>> 9   libgobject-2.0.0.dylib            0x000000010c452859 signal_emit_unlocked_R + 1641
>> 10  libgobject-2.0.0.dylib            0x000000010c45395c g_signal_emit_valist + 2924
>> 11  libgobject-2.0.0.dylib            0x000000010c453f84 g_signal_emit + 116
>> 12  libgtk-quartz-2.0.0.dylib         0x000000010bca0034 gtk_tree_store_remove + 244
>> 13  libgtk-quartz-2.0.0.dylib         0x000000010bca1192 gtk_tree_store_clear_traverse + 82
>> 14  libgtk-quartz-2.0.0.dylib         0x000000010bca116c gtk_tree_store_clear_traverse + 44
>> 15  libgtk-quartz-2.0.0.dylib         0x000000010bca10fb gtk_tree_store_clear + 59
>> 16  subsurface                        0x000000010b7e8963 dive_list_update_dives + 35 (divelist.c:1059)
> 
> That is extremely helpful. This at least tells me where things are going south.
> My only guess is that we somehow managed to mess up the state of the tree model and gtk implodes trying to clear the tree store.
> 
> Of course on my Mac things crash before I get to dive_list_update_dives (and as I mentioned, no useful backtrace in any of the threads).

I now have installed a Ubuntu machine and can reproduce this. And googling for the specific error indicates that we are triggering a long standing Gtk bug here. The instructions for how to work around it are a bit unclear and contradictory, sadly. Some sources tell you to not keep dialogs around and to destroy them instead - that's exactly what we are doing and it is the gtk_widget_destroy call where things crash… 

Fundamentally it's the file select box that is causing this, and different trips that we are loading appear to just subtly change the memory layout and cause this to sometimes fail and sometimes not fail. But from all I was able to learn (and from quality time spent with Valgrind) this is not a bug that my code has introduced, it appears to be a Gtk bug that is just more easily exposed. On some versions of gtk, that is; I still have been unable to trigger this on Fedora 17, regardless how hard I try.

Linus, any other issues that I should be focusing on before this can get pulled?

/D


More information about the subsurface mailing list