[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

poll(), gdb, threads, alsa-lib, deadlock



I'd like another pair of eyes as what I see in a backtrace looks strange.
The full backtrace is attached, two excerpts inline below.

With Fedora 11 (and never before) I see deadlocks in Audacious
occasionally. It's not too easy to reproduce, but starting something
resource-hungry while playing ogg/mp3 makes the player hang up
occasionally.

Two threads enter poll(). One is the Gtk main-loop, the other one the ALSA
plugin play-loop that uses alsa-lib. But why does thread #1 (the Gtk
main-loop) switch to the same fds array address 0x319ff4 as thread #2?
Originally, g_poll() was called with a different pointer 0x8a5fdd8. Why
does the fds address change between g_poll() and poll() while the nfds and
timeout args stay unchanged? What am I missing here?

[Secondly, alsa-lib's snd_pcm_wait calls poll() with an infinite timeout,
which looks dangerous. Obviously, one should only do that if there are
certain guarantees, but apparently those aren't satisfied here.]


Thread 2 (Thread 0xb35ffb70 (LWP 9678)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00280276 in *__GI___poll (fds=0x319ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0x063b1215 in snd1_pcm_wait_nocheck (pcm=0xb362c9a0, timeout=-1) at pcm.c:2367
#3  0x063b1403 in snd_pcm_wait (pcm=0xfffffdfc, timeout=-1) at pcm.c:2338

#4  0x063b1592 in snd1_pcm_write_areas (pcm=0xb362c9a0, areas=0xb35fe9e0, offset=0, size=512, 
    func=0x63bd6f0 <snd_pcm_mmap_write_areas>) at pcm.c:6646


Thread 1 (Thread 0xb7f3c930 (LWP 9671)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00280276 in *__GI___poll (fds=0x319ff4, nfds=3, timeout=9) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0x0070543b in IA__g_poll (fds=0x8a5fdd8, nfds=3, timeout=9) at gpoll.c:127
#3  0x006f81ab in g_main_context_poll (n_fds=<value optimized out>, fds=<value optimized out>, 
    priority=<value optimized out>, timeout=<value optimized out>, context=<value optimized out>)
    at gmain.c:2768
(gdb) thread apply all bt

Thread 7 (Thread 0xb7c26b70 (LWP 9672)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00d5b0d0 in do_sigwait (sig=<value optimized out>, set=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/sigwait.c:63
#2  __sigwait (sig=<value optimized out>, set=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/sigwait.c:100
#3  0x080655fc in gdk_window_show () at gdkwindow.c:3530
#4  0x0071f1bf in g_thread_create_proxy (data=0x8582d60) at gthread.c:635
#5  0x00d52935 in start_thread (arg=0xb7c26b70) at pthread_create.c:297
#6  0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 6 (Thread 0xb6858b70 (LWP 9673)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00d56fa5 in pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:122
#2  0x064945df in ?? () from /usr/lib/libjack.so.0
#3  0x00d52935 in start_thread (arg=0xb6858b70) at pthread_create.c:297
#4  0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 5 (Thread 0xb5da1b70 (LWP 9675)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00d56fa5 in pthread_cond_wait@@GLIBC_2.3.2 ()
---Type <return> to continue, or q <return> to quit---
    at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:122
#2  0x0034f434 in watchdog_func (data=0x0) at cuesheet.c:537
#3  0x0071f1bf in g_thread_create_proxy (data=0x86197e0) at gthread.c:635
#4  0x00d52935 in start_thread (arg=0xb5da1b70) at pthread_create.c:297
#5  0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 4 (Thread 0xb4f78b70 (LWP 9676)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00d56fa5 in pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:122
#2  0x0805e9a7 in gdk_window_show () at gdkwindow.c:3530
#3  0x0071f1bf in g_thread_create_proxy (data=0x85ab880) at gthread.c:635
#4  0x00d52935 in start_thread (arg=0xb4f78b70) at pthread_create.c:297
#5  0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xb4198b70 (LWP 9677)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00d572d2 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:179
#2  0x00357f1e in g_cond_timed_wait_posix_impl (cond=0xfffffdfc, entered_mutex=0x1038d, 
    abs_time=0xb41901e4) at gthread-posix.c:242
#3  0x0805b054 in gdk_window_show () at gdkwindow.c:3530
#4  0x00ec0aff in vorbis_play_loop (arg=<value optimized out>) at vorbis.c:400
---Type <return> to continue, or q <return> to quit---
#5  0x0805c6ae in gdk_window_show () at gdkwindow.c:3530
#6  0x0071f1bf in g_thread_create_proxy (data=0x88aa018) at gthread.c:635
#7  0x00d52935 in start_thread (arg=0xb4198b70) at pthread_create.c:297
#8  0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 2 (Thread 0xb35ffb70 (LWP 9678)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00280276 in *__GI___poll (fds=0x319ff4, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0x063b1215 in snd1_pcm_wait_nocheck (pcm=0xb362c9a0, timeout=-1) at pcm.c:2367
#3  0x063b1403 in snd_pcm_wait (pcm=0xfffffdfc, timeout=-1) at pcm.c:2338
#4  0x063b1592 in snd1_pcm_write_areas (pcm=0xb362c9a0, areas=0xb35fe9e0, offset=0, size=512, 
    func=0x63bd6f0 <snd_pcm_mmap_write_areas>) at pcm.c:6646
#5  0x063bda39 in snd_pcm_mmap_writei (pcm=0xb362c9a0, buffer=0xb35feacc, size=512) at pcm_mmap.c:186
#6  0x063abddc in _snd_pcm_writei (size=<value optimized out>, buffer=<value optimized out>, 
    pcm=<value optimized out>) at pcm_local.h:516
#7  snd_pcm_writei (size=<value optimized out>, buffer=<value optimized out>, pcm=<value optimized out>)
    at pcm.c:1247
#8  0x009ff300 in alsaplug_write_buffer (length=<value optimized out>, data=<value optimized out>)
    at alsa-core.c:214
#9  alsaplug_loop (length=<value optimized out>, data=<value optimized out>) at alsa-core.c:268
#10 0x0071f1bf in g_thread_create_proxy (data=0xb3623e00) at gthread.c:635
#11 0x00d52935 in start_thread (arg=0xb35ffb70) at pthread_create.c:297
#12 0x0028a82e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
---Type <return> to continue, or q <return> to quit---

Thread 1 (Thread 0xb7f3c930 (LWP 9671)):
#0  0x00cd6416 in __kernel_vsyscall ()
#1  0x00280276 in *__GI___poll (fds=0x319ff4, nfds=3, timeout=9) at ../sysdeps/unix/sysv/linux/poll.c:87
#2  0x0070543b in IA__g_poll (fds=0x8a5fdd8, nfds=3, timeout=9) at gpoll.c:127
#3  0x006f81ab in g_main_context_poll (n_fds=<value optimized out>, fds=<value optimized out>, 
    priority=<value optimized out>, timeout=<value optimized out>, context=<value optimized out>)
    at gmain.c:2768
#4  g_main_context_iterate (n_fds=<value optimized out>, fds=<value optimized out>, 
    priority=<value optimized out>, timeout=<value optimized out>, context=<value optimized out>)
    at gmain.c:2450
#5  0x006f87df in IA__g_main_loop_run (loop=0x8a62e28) at gmain.c:2663
#6  0x043991e9 in IA__gtk_main () at gtkmain.c:1205
#7  0x0805a608 in gdk_window_show () at gdkwindow.c:3530
#8  0x001c2a66 in __libc_start_main (main=0x805a060 <gdk_window_show+23384>, argc=1, ubp_av=0xbf837264, 
    init=0x80b63d0 <gdk_window_show+401096>, fini=0x80b63c0 <gdk_window_show+401080>, 
    rtld_fini=0xb94030 <_dl_fini>, stack_end=0xbf83725c) at libc-start.c:220
#9  0x08054541 in gdk_window_show () at gdkwindow.c:3530

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]