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

Michael Schwendt mschwendt at gmail.com
Wed Jul 8 09:00:21 UTC 2009


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: audacious-deadlock-1.txt
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20090708/5edb76b5/attachment.txt>


More information about the fedora-devel-list mailing list