Bug 39219 - libgl conflict with xbmc causes lock up on xbmc exit
libgl conflict with xbmc causes lock up on xbmc exit
Product: Mesa
Classification: Unclassified
Component: GLX
x86-64 (AMD64) Linux (All)
: medium normal
Assigned To: mesa-dev
Depends on:
  Show dependency treegraph
Reported: 2011-07-14 02:55 UTC by Padfoot
Modified: 2012-04-09 22:27 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:

Backtrace Xbmc 10.1 libgl 7.10.3 after SIGTERM (3.13 KB, text/plain)
2011-07-14 02:55 UTC, Padfoot
patch (467 bytes, patch)
2011-07-15 05:27 UTC, Henri Verbeet
Details | Splinter Review
Backtrace Xbmc 10.1 liibgl-7.10.3 (patched) (1.15 KB, text/plain)
2011-07-15 14:54 UTC, Padfoot
patch (1.42 KB, patch)
2011-07-19 04:10 UTC, Henri Verbeet
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Padfoot 2011-07-14 02:55:49 UTC
Created attachment 49074 [details]
Backtrace Xbmc 10.1 libgl 7.10.3 after SIGTERM

Confirmed on x86_64 and x86, Arch, Fedora, Gentoo & Ubuntu

libgl 7.10.3 and libgl 7.11 conflict with xbmc 10.1 causing xbmc to lock up on exit.

Downgrading to libgl 7.10.2 resolves ths issue.

Backtrace of xbmc 10.1 with libgl 7.10.3 attached. As xbmc locks up, I am only able to get the trace after the xbmc process is killed.

This is also reported on xbmc bug tracker http://trac.xbmc.org/ticket/11690

Steps to reproduce:

Install xbmc 10.1 and libgl 7.10.3
Launch xbmc 10.1
Select Exit / Reboot / Shutdown option in xbmc 10.1
Application hangs on exit.
Comment 1 Ian Romanick 2011-07-14 10:14:00 UTC
Below is the top bit of the stacktrace from the Xbmc bugzilla.  This seems to point the finger at some GLX changes.  The only GLX changes in 7.10.3 are related to Darwin builds (unlikely to be the problem) or Henri's display destruction clean ups (43ad25ba and db17691).

Is there any chance of getting a bisect?

#0  0xb7fde424 in __kernel_vsyscall ()
#1  0xb7108432 in __lll_lock_wait ()
   from /lib/libpthread.so.0
#2  0xb7103dbd in _L_lock_488 () from /lib/libpthread.so.0
#3  0xb7103c03 in pthread_mutex_lock ()
   from /lib/libpthread.so.0
#4  0xb66e8d3f in ?? () from /usr/lib/libX11.so.6
#5  0xb6f86f2a in __glXInitialize (dpy=0x8d73140)
    at glxext.c:796
#6  0xb6fa6c2a in driReleaseDrawables (gc=0x915c5a8)
    at dri_common.c:386
#7  0xb6faa134 in dri2_destroy_context (context=0x915c5a8)
    at dri2_glx.c:121
#8  0xb6f8629d in glx_display_free (priv=0x8dd7058)
    at glxext.c:230
#9  0xb6f86375 in __glXCloseDisplay (dpy=0x8d73140,
    codes=0x915bb8c) at glxext.c:278
#10 0xb66d7afb in XCloseDisplay ()
   from /usr/lib/libX11.so.6
Comment 2 Henri Verbeet 2011-07-15 05:27:14 UTC
Created attachment 49135 [details] [review]

I suspect db17691, because of __glXInitialize() being called while already under _Xglobal_lock. I'm not sure why this doesn't happen for me though, it behaves as a recursive lock here. Did _Xglobal_lock change to being recursive at some point? Does the attached patch (only briefly tested) make it any better?
Comment 3 Padfoot 2011-07-15 13:55:00 UTC
Compiling patched version. Will report back.
Comment 4 Padfoot 2011-07-15 14:54:38 UTC
Created attachment 49165 [details]
Backtrace Xbmc 10.1 liibgl-7.10.3 (patched)

Patched version 7.10.3 works.

Xbmc 10.1 now exits cleanly (as shown in new backtrace attached).

(Tested on 32 bit Arch kernel

Comment 5 Henri Verbeet 2011-07-19 04:10:11 UTC
Created attachment 49295 [details] [review]

This is a slightly modified version of the same patch. If it's not too much trouble, could you give this one a try as well? If it still works I'll push it.
Comment 6 Rider 2011-07-19 04:55:29 UTC
new patch works on i686 Arch Linux (
Comment 7 Padfoot 2011-07-19 14:55:50 UTC
Compiling with modified patch.
Comment 8 Padfoot 2011-07-19 15:53:15 UTC

Modified patch works on x86 & x86_64 Arch

Thankyou so much for your speedy resolution.

Comment 9 daytooner 2011-08-19 16:57:41 UTC
This problem still exists for me:

Eedora 15 x86-64
xbmc 10.1

(Note: mesa-lebGL is from the Fedora repositories.)

Comment 10 Padfoot 2011-08-20 00:49:40 UTC
@ daytooner:

Refer to your version of libgl: mesa-libGL-7.11-0.16.20110709.0.fc15.x86_64

Your version was packaged on 9 July. The patched version was released after 19 July.

You need to update to the latest version for the resolution.

Comment 11 Shawn Landden 2012-04-09 22:25:47 UTC
I'm getting this problem with XBMC from the xserssion and ubuntu precise xorg-edgers

can i get a commit sha1 for the supposed fix?

backtrace in hang:

#0  0x00007f2ae9fd6148 in pthread_join (threadid=139821913728768, thread_return=0x0) at pthread_join.c:89
#1  0x000000000068306b in CXHandle::~CXHandle() ()
#2  0x0000000000683109 in CXHandle::~CXHandle() ()
#3  0x0000000000682e86 in CloseHandle(CXHandle*) ()
#4  0x0000000000e6d504 in CThread::~CThread() ()
#5  0x00007f2ae5ed3921 in __run_exit_handlers (status=0, listp=0x7f2ae624e688, run_list_atexit=true) at exit.c:78
#6  0x00007f2ae5ed39a5 in __GI_exit (status=<optimized out>) at exit.c:100
#7  0x00007f2ae5eb9774 in __libc_start_main (main=0x660530 <main>, argc=2, ubp_av=0x7fffd704e9d8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffd704e9c8) at libc-start.c:258
#8  0x0000000000661319 in _start ()
Comment 12 Shawn Landden 2012-04-09 22:27:00 UTC
xserver-xorg-video-radeon (1:6.14.99+git20120330.de2419e5-0ubuntu0sarvatt2) ...
xserver-xorg-core (2: ...
libdrm2 (2.4.33+git20120403.43704256-0ubuntu0ricotz) ...
libgl1-mesa-dri (8.0.2+git20120330+8.0.54f73916-0ubuntu0sarvatt) ...