[pulseaudio-discuss] PulseAudio 0.9.21 deadlocking when accessed through OpenAl 1.10.622 (AlienArena)

Kelly Anderson kelly at silka.with-linux.com
Wed Dec 23 00:21:38 PST 2009


AlienArena was deadlocking trying to go through OpenAl which was set to 
use PulseAudio.  After quite a bit of debugging (entering prints in 
OpenAl pulse code), I finally found a solution with the help of a SUSE 
bug report.

http://lists.opensuse.org/opensuse-bugs/2009-10/msg10497.html

which points at this commit.

http://git.0pointer.de/?p=pulseaudio.git;a=commitdiff;h=4f5e2b745ea357e2b5c815ff33a556505a7d1f18

Here's an strace (with prints sprinkled in the OpenAl pulse code) which 
demonstrates the deadlock.  A patch to undo the commit is at the end.

write(3, "pDeviceName:PulseAudio Software\n"..., 32) = 32
write(3, "qalcOpenDevice:PulseAudio Softwar"..., 35) = 35
mmap(NULL, 864256, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0x7f07b822d000
brk(0x626f000)                          = 0x626f000
write(2, "AL lib: pulseaudio.c:356: pulse_o"..., 39AL lib: 
pulseaudio.c:356: pulse_open()
) = 39
readlink("/proc/self/exe", "/usr/share/games/AlienArena/crx"..., 99) = 31
write(2, "AL lib: pulseaudio.c:362: startin"..., 62AL lib: 
pulseaudio.c:362: starting pa_threaded_mainloop_new()
) = 62
pipe([4, 5])                            = 0
fcntl(4, F_GETFL)                       = 0 (flags O_RDONLY)
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
fcntl(5, F_GETFL)                       = 0x1 (flags O_WRONLY)
fcntl(5, F_SETFL, O_WRONLY|O_NONBLOCK)  = 0
fcntl(4, F_GETFD)                       = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fcntl(5, F_GETFD)                       = 0
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
write(2, "AL lib: pulseaudio.c:369: startin"..., 64AL lib: 
pulseaudio.c:369: starting pa_threaded_mainloop_start()
) = 64
mmap(NULL, 8392704, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f07afb57000
mprotect(0x7f07afb57000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f07b03571f0, 
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, 
parent_tidptr=0x7f07b03579e0, tls=0x7f07b0357910, 
child_tidptr=0x7f07b03579e0) = 5393
write(2, "AL lib: pulseaudio.c:376: startin"..., 63AL lib: 
pulseaudio.c:376: starting pa_threaded_mainloop_lock()
) = 63
write(2, "AL lib: pulseaudio.c:380: startin"..., 52AL lib: 
pulseaudio.c:380: starting pa_context_new()
) = 52
open("/home/kelly/.pulse/client.conf", O_RDONLY) = -1 ENOENT (No such 
file or directory)
open("/etc/pulse/client.conf", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=1184, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7f07b833e000
read(6, "# This file is part of PulseAudio"..., 4096) = 1184
read(6, ""..., 4096)                    = 0
open("/home/kelly/.pulse-cookie", O_RDWR|O_CREAT|O_NOCTTY, 0600) = 7
fcntl(7, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
read(7, 
"d\321\303\334\277\346B\370\217!7\367v.H\261\273\212<\222\330))=K\360Q\24g\354z at E"..., 
256) = 256
fcntl(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
close(7)                                = 0
close(6)                                = 0
munmap(0x7f07b833e000, 4096)            = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 6
connect(6, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"...}, 20) = 0
getpeername(6, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0\22"...}, 
[139668041498644]) = 0
uname({sys="Linux", node="bs", ...})    = 0
access("/home/kelly/.Xauthority", R_OK) = 0
open("/home/kelly/.Xauthority", O_RDONLY) = 7
fstat(7, {st_mode=S_IFREG|0600, st_size=581, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7f07b833e000
read(7, "\0\0\0\4\300\250\1\7\0\0010\0\22MIT-MAGIC-COOKIE-1\0\20"..., 
4096) = 581
read(7, ""..., 4096)                    = 0
close(7)                                = 0
munmap(0x7f07b833e000, 4096)            = 0
getsockname(6, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0\22"...}, 
[139668041498626]) = 0
fcntl(6, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"l\0\v\0\0\0\22\0\20\0\0\0"..., 12}, {""..., 0}, 
{"MIT-MAGIC-COOKIE-1"..., 18}, {"\0\0"..., 2}, 
{"lfn<\236\303N\331\370\32,\271y\213b;"..., 16}, {""..., 0}], 6) = 48
read(6, "\1\0\v\0\0\0c\0"..., 8)        = 8
read(6, 
"\230P\243\0\0\0\340\3\377\377\37\0\0\1\0\0\24\0\377\377\1\7\0\0  
\10\377\0\0\0\0T"..., 396) = 396
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"b\0\5\0\f\0\0\0BIG-REQUESTS"..., 20}], 1) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\1\0\0\0\0\0\1\216\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\216\0\1\0"..., 4}], 1)    = 4
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\2\0\0\0\0\0\377\377?\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) 
= 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, 
[{"7\0\5\0\0\0\340\3k\0\0\0\10\0\0\0\377\377\377\0\24\0\6\0k\0\0\0\27\0\0\0\37"..., 
44}, {NULL, 0}, {""..., 0}], 3) = 44
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\10\4\0\241\r\0\0\37\0\0\0\0\0\0\0\2046\0\0\0\0\0\0\0\0\0\0\0\0\0\0*"..., 
4096) = 4096
read(6, "SelectionBox.foreground:\t#141312\n"..., 9892) = 9892
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"b\0\5\0\t\0\340\3"..., 8}, {"XKEYBOARD"..., 9}, 
{"\0\0\0"..., 3}], 3) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\5\0\0\0\0\0\1\220`\232\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) 
= 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\220\0\2\0\1\0\0\0"..., 8}, {NULL, 0}, {""..., 0}], 3) = 8
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\1\6\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\20\0\5\0\f\0\0\0PULSE_SERVER"..., 20}, {NULL, 0}, {""..., 
0}], 3) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\7\0\0\0\0\0\362\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\24\0\6\0k\0\0\0\362\1\0\0\37\0\0\0\0\0\0\0\0\1\0\0"..., 
24}, {NULL, 0}, {""..., 0}], 3) = 24
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\20\0\5\0\n\0\0\0PULSE_SINK\0\0"..., 20}, {NULL, 0}, 
{""..., 0}], 3) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\t\0\0\0\0\0\363\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\24\0\6\0k\0\0\0\363\1\0\0\37\0\0\0\0\0\0\0\0\1\0\0"..., 
24}, {NULL, 0}, {""..., 0}], 3) = 24
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\20\0\5\0\f\0\0\0PULSE_SOURCE"..., 20}, {NULL, 0}, {""..., 
0}], 3) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\v\0\0\0\0\0\364\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\24\0\6\0k\0\0\0\364\1\0\0\37\0\0\0\0\0\0\0\0\1\0\0"..., 
24}, {NULL, 0}, {""..., 0}], 3) = 24
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\20\0\5\0\f\0\0\0PULSE_COOKIE"..., 20}, {NULL, 0}, {""..., 
0}], 3) = 20
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\r\0\0\0\0\0\365\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"\24\0\6\0k\0\0\0\365\1\0\0\37\0\0\0\0\0\0\0\0\1\0\0"..., 
24}, {NULL, 0}, {""..., 0}], 3) = 24
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\0\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"<\0\2\0\0\0\340\3+\1\1\0"..., 12}, {NULL, 0}, {""..., 0}], 
3) = 12
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
read(6, 
"\1\1\20\0\0\0\0\0\31\0\240\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 32
read(6, 0x62507b4, 4096)                = -1 EAGAIN (Resource 
temporarily unavailable)
close(6)                                = 0
open("/dev/shm/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 6
getdents(6, /* 19 entries */, 32768)    = 928
statfs("/dev/shm/", {f_type=0x1021994, f_bsize=4096, f_blocks=474383, 
f_bfree=474073, f_bavail=474073, f_files=474383, f_ffree=474365, 
f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
futex(0x7f07b54b1320, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/dev/shm/pulse-shm-3807146384", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0400, st_size=67108904, ...}) = 0
mmap(NULL, 67112960, PROT_READ, MAP_SHARED, 7, 0) = 0x7f07abb56000
close(7)                                = 0
kill(12091, SIG_0)                      = -1 ESRCH (No such process)
munmap(0x7f07abb56000, 67112960)        = 0
unlink("/dev/shm/pulse-shm-3807146384") = 0
open("/dev/shm/pulse-shm-1373032762", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0400, st_size=67108904, ...}) = 0
mmap(NULL, 67112960, PROT_READ, MAP_SHARED, 7, 0) = 0x7f07abb56000
close(7)                                = 0
kill(2252, SIG_0)                       = 0
munmap(0x7f07abb56000, 67112960)        = 0
open("/dev/shm/pulse-shm-3131892746", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0400, st_size=67108904, ...}) = 0
mmap(NULL, 67112960, PROT_READ, MAP_SHARED, 7, 0) = 0x7f07abb56000
close(7)                                = 0
kill(2275, SIG_0)                       = 0
munmap(0x7f07abb56000, 67112960)        = 0
open("/dev/shm/pulse-shm-3868754456", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0400, st_size=67108904, ...}) = 0
mmap(NULL, 67112960, PROT_READ, MAP_SHARED, 7, 0) = 0x7f07abb56000
close(7)                                = 0
kill(2347, SIG_0)                       = 0
munmap(0x7f07abb56000, 67112960)        = 0
open("/dev/shm/pulse-shm-1500027736", O_RDONLY|O_NOFOLLOW|O_CLOEXEC) = 7
fstat(7, {st_mode=S_IFREG|0400, st_size=67108904, ...}) = 0
mmap(NULL, 67112960, PROT_READ, MAP_SHARED, 7, 0) = 0x7f07abb56000
close(7)                                = 0
kill(2275, SIG_0)                       = 0
munmap(0x7f07abb56000, 67112960)        = 0
getdents(6, /* 0 entries */, 32768)     = 0
close(6)                                = 0
open("/dev/urandom", O_RDONLY|O_NOCTTY) = 6
read(6, "\235/0\251"..., 4)             = 4
close(6)                                = 0
open("/dev/shm/pulse-shm-2838507421", 
O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC, 0400) = 6
ftruncate(6, 67108904)                  = 0
mmap(NULL, 67112960, PROT_READ|PROT_WRITE, MAP_SHARED, 6, 0) = 
0x7f07abb56000
close(6)                                = 0
readlink("/proc/self/exe", "/usr/share/games/AlienArena/crx"..., 99) = 31
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/lib64/gconv/gconv-modules", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=56028, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7f07b833e000
read(6, "# GNU libc iconv configuration.\n#"..., 4096) = 4096
read(6, "B1.002//\nalias\tJS//\t\t\tJUS_I.B1.00"..., 4096) = 4096
read(6, "59-3\t1\nmodule\tINTERNAL\t\tISO-8859-"..., 4096) = 4096
read(6, "859-14//\nalias\tISO-IR-199//\t\tISO-"..., 4096) = 4096
read(6, "CDIC-DK-NO-A//\tEBCDIC-DK-NO-A\t1\n\n"..., 4096) = 4096
read(6, "\t\tIBM281//\t\tIBM281\t\t1\n\n#\tfrom\t\t\tt"..., 4096) = 4096
read(6, "\tIBM863\t\t1\n\n#\tfrom\t\t\tto\t\t\tmodule\t"..., 4096) = 4096
read(6, "//\t\tIBM937//\nalias\tCSIBM937//\t\tIB"..., 4096) = 4096
read(6, "JAPANESE//\tEUC-JP//\nalias\tOSF0003"..., 4096) = 4096
read(6, "MACINTOSH//\t\tMACINTOSH\t1\n\n#\tfrom\t"..., 4096) = 4096
read(6, "367-BOX//\nalias\tISO_10367BOX//\t\tI"..., 4096) = 4096
read(6, "EUC-JISX0213//\t\tINTERNAL\t\tEUC-JIS"..., 4096) = 4096
brk(0x6290000)                          = 0x6290000
read(6, "/\t\tIBM1130//\nalias\tCSIBM1130//\t\tI"..., 4096) = 4096
read(6, "\t1\n\n#\tfrom\t\t\tto\t\t\tmodule\t\tcost\nal"..., 4096) = 2780
read(6, ""..., 4096)                    = 0
close(6)                                = 0
munmap(0x7f07b833e000, 4096)            = 0
futex(0x7f07b4e73f60, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "AL lib: pulseaudio.c:391: startin"..., 67AL lib: 
pulseaudio.c:391: starting pa_context_set_state_callback()
) = 67
write(2, "AL lib: pulseaudio.c:394: startin"..., 56AL lib: 
pulseaudio.c:394: starting pa_context_connect()
) = 56
stat("/home/kelly/.pulse", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
getuid()                                = 1000
getuid()                                = 1000
stat("/tmp/pulse-kelly", 0x7fff1b04b700) = -1 ENOENT (No such file or 
directory)
stat("/home/kelly", {st_mode=S_IFDIR|0711, st_size=102400, ...}) = 0
getuid()                                = 1000
umask(077)                              = 022
mkdir("/home/kelly/.pulse", 0700)       = -1 EEXIST (File exists)
umask(022)                              = 077
getuid()                                = 1000
getgid()                                = 100
chown("/home/kelly/.pulse", 1000, 100)  = 0
chmod("/home/kelly/.pulse", 0700)       = 0
lstat("/home/kelly/.pulse", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
open("/var/lib/dbus/machine-id", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=33, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x7f07b833e000
read(6, "6b55d410fb2deb37ac9eac75490b5f47\n"..., 4096) = 33
close(6)                                = 0
munmap(0x7f07b833e000, 4096)            = 0
readlink("/home/kelly/.pulse/6b55d410fb2deb37ac9eac75490b5f47-runtime", 
"/tmp/pulse-RwKSB1FebW39"..., 99) = 23
lstat("/tmp/pulse-RwKSB1FebW39", {st_mode=S_IFDIR|0700, st_size=24, 
...}) = 0
getuid()                                = 1000
socket(PF_FILE, SOCK_STREAM, 0)         = 6
fcntl(6, F_GETFD)                       = 0
fcntl(6, F_SETFD, FD_CLOEXEC)           = 0
setsockopt(6, SOL_SOCKET, SO_PRIORITY, [6], 4) = 0
fcntl(6, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
connect(6, {sa_family=AF_FILE, 
path="/home/kelly/.pulse/6b55d410fb2deb37ac9eac75490b5f47-runtime/native"...}, 
110) = 0
write(2, "AL lib: pulseaudio.c:407: startin"..., 58AL lib: 
pulseaudio.c:407: starting pa_context_get_state()
) = 58
nanosleep({0, 1000000}, NULL)           = 0
write(2, "AL lib: pulseaudio.c:429: startin"..., 92AL lib: 
pulseaudio.c:429: starting pa_threaded_mainloop_wait(), 
state=PA_CONTEXT_CONNECTING
) = 92
futex(0x624d150, FUTEX_UNLOCK_PI_PRIVATE, 0) = 0
futex(0x624d2b4, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
write(2, "AL lib: pulseaudio.c:431: startin"..., 65AL lib: 
pulseaudio.c:431: starting pa_threaded_mainloop_accept()
) = 65
futex(0x624d2f4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x624d2f0, {FUTEX_OP_SET, 
0, FUTEX_OP_CMP_GT, 1}) = 1
write(2, "AL lib: pulseaudio.c:429: startin"..., 93AL lib: 
pulseaudio.c:429: starting pa_threaded_mainloop_wait(), 
state=PA_CONTEXT_AUTHORIZING
) = 93
futex(0x624d150, FUTEX_UNLOCK_PI_PRIVATE, 0) = 0
futex(0x624d2b4, FUTEX_WAIT_PRIVATE, 3, NULL
***** It's deadlocked here *****

Here's a patch which undoes the mentioned commit and gets everything 
working.

--- ./src/pulse/thread-mainloop.c.orig    2009-08-10 12:07:12.000000000 
-0600
+++ ./src/pulse/thread-mainloop.c    2009-12-23 00:31:44.994003640 -0700
@@ -51,7 +51,7 @@

  struct pa_threaded_mainloop {
      pa_mainloop *real_mainloop;
-    int n_waiting, n_waiting_for_accept;
+    int n_waiting;

      pa_thread* thread;
      pa_mutex* mutex;
@@ -190,12 +190,8 @@ void pa_threaded_mainloop_signal(pa_thre

      pa_cond_signal(m->cond, 1);

-    if (wait_for_accept) {
-        m->n_waiting_for_accept ++;
-
-        while (m->n_waiting_for_accept > 0)
-            pa_cond_wait(m->accept_cond, m->mutex);
-    }
+    if (wait_for_accept && m->n_waiting > 0)
+        pa_cond_wait(m->accept_cond, m->mutex);
  }

  void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
@@ -218,9 +214,6 @@ void pa_threaded_mainloop_accept(pa_thre
      /* Make sure that this function is not called from the helper 
thread */
      pa_assert(!m->thread || !pa_thread_is_running(m->thread) || 
!in_worker(m));

-    pa_assert(m->n_waiting_for_accept > 0);
-    m->n_waiting_for_accept --;
-
      pa_cond_signal(m->accept_cond, 0);
  }





More information about the pulseaudio-discuss mailing list