GNOME Bugzilla – Bug 424425
Ghex crashed on closing
Last modified: 2014-12-22 15:30:55 UTC
Steps to reproduce: 1. Right-click on a file, choose open with GHex 2. GHex is opened, displaying the file content 3. Close the window, crash occured Stack trace: Memory status: size: 23838720 vsize: 0 resident: 23838720 share: 0 rss: 12914688 rss_rlim: 0 CPU usage: start_time: 1175248479 rtime: 0 utime: 67 stime: 0 cutime:61 cstime: 0 timeout: 6 it_real_value: 0 frequency: 0 Backtrace was generated from '/usr/bin/ghex2' (no debugging symbols found) Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread -1225426752 (LWP 18974)] 0xffffe410 in __kernel_vsyscall ()
+ Trace 123472
Thread 1 (Thread -1225426752 (LWP 18974))
Other information: I'm not sure this the right place for this bug, I didn't find an entry for libgail. Do not hesitate to contact me if I can provide more information. Kind Regards, Charlie.
Looks like a crash in gail rather than ghex.
*** Bug 465127 has been marked as a duplicate of this bug. ***
As written in Bug 465127 -- it's likely a problem with a misplaced GDK_THREADS_ENTER. See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=227828#c10 and the comments below it for some more details on the issue. Li Yuan, could you confirm this so we can move this bug back to ghex, where it afaics belongs?
From https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=246560#c1, the trace is very similar to this bug. Unfortunately it doesn't get any gail symbols in it :( I think it maybe a bug in gail. I don't find any clue points to GDK_THREADS_ENTER...
I don't think an additional call to GDK_THREADS_ENTER in every app using gail is an appropriate solution. I grepped through the ghex source for thread, and it calls only GDK_THREADS_ENTER/GDK_THREADS_LEAVE in one function, which appears to be unrelated to the crash. The redhat bug seems to imply that calling GDK_THREADS_ENTER before gnome_program_init is a new gail requirement. Perhaps gail_init should be making the call to GDK_THREADS_ENTER, or do what it's doing some other way, so as to avoid crashing applications. GHex isn't even calling any of the _threads_init methods, so I don't see why it should be adding those just to satisfy a new requirement of gail. And it seems as if this issue affects multiple applications, so rather than requiring all of those applications to add all of the thread init calls, it seems best to fix the problem at the source, than duplicating a workaround in all the apps.
(In reply to comment #5) > I don't think an additional call to GDK_THREADS_ENTER in every app using gail > is an appropriate solution. AFAIK there is no "additional call" needed (at least in the mail-notification case there was no additional one needed). It just needs to be called right after "gdk_threads_init ();" afaik (but my programming skills are limited and that is only based on the comments I heard on this issue).
(In reply to comment #6) > AFAIK there is no "additional call" needed (at least in the mail-notification > case there was no additional one needed). It just needs to be called right > after "gdk_threads_init ();" afaik (but my programming skills are limited and > that is only based on the comments I heard on this issue). Where does the _LEAVE get called for that _ENTER though? I understand there may have been a threading issue in the mail notifier, but then that is an issue for the mail notifier. GHex doesn't directly call gdk_threads_init (). If the suggestion is that all apps need to do this, then it is additional work, that should probably actually be done by the dependent library that is requiring it to be done, rather than all the apps.
(In reply to comment #5) First I don't know why we discuss thread problem here.:) From the trace:
+ Trace 154539
> I don't think an additional call to GDK_THREADS_ENTER in every app using gail > is an appropriate solution. I grepped through the ghex source for thread, and > it calls only GDK_THREADS_ENTER/GDK_THREADS_LEAVE in one function, which > appears to be unrelated to the crash. Accessibility never suggestion any program makes additional call to GDK_THREADS_ENTER. Program written under GNOME documents should work. Please refer to http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html: "As always, you must also surround any calls to GTK+ not made within a signal handler with a gdk_threads_enter()/gdk_threads_leave() pair." Gail just assumes it is always called under GDK lock. > The redhat bug seems to imply that calling GDK_THREADS_ENTER before > gnome_program_init is a new gail requirement. This is not gail requirement, this is GNOME requirement, if the application is multi-threads. > Perhaps gail_init should be > making the call to GDK_THREADS_ENTER, or do what it's doing some other way, so > as to avoid crashing applications. GHex isn't even calling any of the > _threads_init methods, You said GHex calls GDK_THREADS_ENTER/GDK_THREADS_LEAVE once. It doesn't initialize threads before using it? > so I don't see why it should be adding those just to > satisfy a new requirement of gail. And it seems as if this issue affects > multiple applications, Maybe because these applications don't do what GNOME requires. If an application is written under GNOME document and have such a problem, it should be A11Y's bug. > so rather than requiring all of those applications to > add all of the thread init calls, it seems best to fix the problem at the > source, than duplicating a workaround in all the apps. A11Y should not require any other application calling thread_init if there are only one thread in the application. If the application is multi-threads, please call it under GNOME documents.
(In reply to comment #7) > Where does the _LEAVE get called for that _ENTER though? The example is from http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html : int main (int argc, char *argv[]) { GtkWidget *window; g_thread_init (NULL); gdk_threads_init (); gdk_threads_enter (); gtk_init (&argc, &argv); window = create_window (); gtk_widget_show (window); gtk_main (); gdk_threads_leave (); return 0; } > I understand there may > have been a threading issue in the mail notifier, but then that is an issue for > the mail notifier. GHex doesn't directly call gdk_threads_init (). Is GHex thread enabled?
I'm a little confused what we discussed here... What problem does GHex have in this conversation? Only this crash? It should not be a problem relative to thread but a bug in gail I think. If it is relative to thread_init and the first call to thread_enter, the crash probably cannot wait until the close :-) To clarify, A11Y never *require* applications to do anything which is not the normal GNOME requirement). If GHex is not thread enabled, it is OK, it should work with A11Y. If GHex is thread enabled, just do what GNOME requirement, then if should work with A11Y.
GHex does not appear to me to be using threads. It doesn't create mutexes and lock them. It doesn't call any of the _thread_init methods. It does call _THREAD_ENTER/LEAVE in one single function in the entire source. However, not using threads for anything, I'm not sure that it even has any effect. It should already be in the main thread, and under a GDK lock if any. I'm inclined to believe this is a valid gail bug. Thorsten keeps bringing up the thread issue because it seemed to work around a similar, if not the same, problem in mail-notifier.
I don't think this is a problem anymore - ghex starts and stops without any problems nowadays