GNOME Bugzilla – Bug 397139
glib-2.12.8 breaks ABI
Last modified: 2011-02-18 15:50:41 UTC
The addition of the gettime member to the _GThreadFunctions struct breaks the GLib ABI. The result is that some programs that make use of GTimer need to be rebuilt against the new GLib. One such program is evince. If you start evince after upgrading to glib-2.12.8, you will get the following crash: % gdb evince (gdb) r Starting program: /usr/local/bin/evince warning: Unable to get location for thread creation breakpoint: generic error [New LWP 100138] [New Thread 0x80b5000 (LWP 100138)] Program received signal SIGSEGV, Segmentation fault.
+ Trace 102600
Thread 134959104 (LWP 100138)
If evince is simply rebuilt, this crash goes away. Reverting the gtimer.c and gthread-related diffs between 2.12.7 and 2.12.8 also resolve the problem. Evolution also refuses to start after upgrading to 2.12.8. The error seen is: GLib-ERROR **: gmem.c:154: failed to allocate 1365219474 bytes aborting... Abort (core dumped)
Does evince register its own GThreadFunctions in the call to g_thread_init() or g_thread_init_with_errorcheck_mutexes()?
*** Bug 397117 has been marked as a duplicate of this bug. ***
No, evince uses g_thread_init (NULL).
Hmm, too bad. I wouldn't have expected this to break. In that case, we'll have to move gettext out of the struct
Created attachment 80399 [details] [review] a patch Here is a patch that moves the gettime function out of the GThreadFunctions struct and into its own variable. That should fix the abi breakage. Does this work for you ?
Matthias, will you also re-add a clock_gettime symbol to glib.so? I also wonder whether not linking against gthread anymore isn't an ABI breakage in itself: if people have been linking their gthread + glib using programs since glib 2.12.2 with only -lglib, it worked but broke in 2.12.8. Perhaps you would like to continue linking to gthread until the end of the 2.12.x series now, and re-introduce the clock_gettime in glib.so?
no, this is a total misunderstanding. clock_gettime was never exported from glib. It is in librt, and due to an oversight, glib got linked against librt for a short time. That does not mean we have an obligation to continue that mistake. clock_gettime is not in any glib headers. People who use clock_gettime need to include sys/time.h and link against librt.
This patch does fix the crashes.
2007-01-16 Matthias Clasen <mclasen@redhat.com> * glib/gthread.h: * glib/gthread.c: * glib/glib.symbols: Revert an accidental ABI break by moving gettime out of the GThreadFunctions struct and making it a separate variable. (#397139, Joe Marcus Clarke) * gthread/*.c: Adapt.
I upgrade to glib 2.12.9 and gtk+ 2.10.8, now gnome-panel refuse to start, It seems the memory allocation failed. Is this caused by this problem?
No, thats an unrelated double-free bug in gtk+ 2.10.8 that has been fixed already in svn, but not in a release yet.