<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title></title><meta http-equiv="Content-type" content="text/html; charset=UTF-8" /><style type="text/css">p { margin:0px; padding:0px; }</style></head><body style='background-color:rgb(255, 255, 255);background-image:none;background-repeat:repeat;background-position:0% 0%;font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:12px;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;padding-top:5px;padding-bottom:5px;padding-left:5px;padding-right:5px;'><p style="font-family:Verdana;"><font size="2"><blockquote type="cite" face="Verdana" class="quote" style="font-size:12px;"><div><div><pre>On Tue, 05.01.10 18:02, Kelly Anderson (kelly@silka.with-linux.com) wrote:<br /><br />&gt; Here is a copy of the function in OpenAl 1.10.622 with a comment on<br />&gt; when and where the deadlock occurs.<font size="2"> <br /></font></pre></div></div></blockquote></font></p><p style="font-family:Verdana;">First, I'd like to say I'm no expert when it comes to pulseaudio, and programming is enough to get by. But having a look at where you claim it to deadlock, I'm pretty certain that you haven't applied the patch properly. As that is where it deadlocks for me when the patch isn't applied also.<span></span></p><p id="__paragraph__1263537143000" style="font-family:Verdana;"><br /><span></span></p><p id="__paragraph__1263537143000" style="font-family:Verdana;"><span>This is a strace of what I get with the patch is not applied (sometimes, as the deadlock is random).</span><span></span></p><p id="__paragraph__1263537205000" style="font-family:Verdana;"><br /><span></span></p><p id="__paragraph__1263537205000" style="font-family:Verdana;">socket(PF_FILE, SOCK_STREAM, 0)         = 6<br />fcntl64(6, F_GETFD)                     = 0<br />fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0<br />setsockopt(6, SOL_SOCKET, SO_PRIORITY, [6], 4) = 0<br />fcntl64(6, F_GETFL)                     = 0x2 (flags O_RDWR)<br />fcntl64(6, F_SETFL, O_RDWR|O_NONBLOCK)  = 0<br />connect(6, {sa_family=AF_FILE, path=&quot;/home/jstdio/.pulse/b0f5cbbcf4211dc7544066c04ac2621b-runtime/native&quot;}, 110) = 0<br />clock_gettime(CLOCK_MONOTONIC, {169, 929788903}) = 0<br />write(2, &quot;AL lib: pulseaudio.c:391: starti&quot;..., 72AL lib: pulseaudio.c:391: starting pa_threaded_mainloop_wait() state: 1) = 72<br />futex(0xf431424, FUTEX_WAIT_PRIVATE, 1, NULL) = 0<br />futex(0xf423bc0, FUTEX_LOCK_PI_PRIVATE, 1PA lib: thread-mainloop.c:223: inside pa_threaded_mainloop_signal() n_waiting_for_accept: 1651076144) = 0<br />write(2, &quot;AL lib: pulseaudio.c:394: starti&quot;..., 74AL lib: pulseaudio.c:394: starting pa_threaded_mainloop_accept() state: 1) = 74<br />futex(0xf441b40, FUTEX_WAIT_PRIVATE, 2, NULL) = 0<br />futex(0xf441b44, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0xf441b40, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1<br />write(2, &quot;AL lib: pulseaudio.c:391: starti&quot;..., 72AL lib: pulseaudio.c:391: starting pa_threaded_mainloop_wait() state: 2) = 72<br />futex(0xf423bc0, FUTEX_UNLOCK_PI_PRIVATE, -1215631372) = 0<br />futex(0xf431424, FUTEX_WAIT_PRIVATE, 3, NULL &lt;unfinished ...&gt;<br /></p><p id="__paragraph__1263537205000" style="font-family:Verdana;"><br /></p><p id="__paragraph__1263537205000" style="font-family:Verdana;">It stops exactly where you claim it to deadlock - the second time doing pa_threaded_mainloop_wait() - and the reason why is because n_waiting_for_accept = 1651076144.<span></span></p><p id="__paragraph__1263537298000" style="font-family:Verdana;"><span>Alc/pulseaudio.c on line 394 sends a pa_threaded_mainloop_accept() which tells pulseaudio to decrement n_waiting_for_accept, but pulseaudio won't continue until the named variable is equal to, or less than 0.</span><span></span></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><br /><span></span></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;">With the patch applied, this doesn't happen.<br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;">socket(PF_FILE, SOCK_STREAM, 0)         = 6<br />fcntl64(6, F_GETFD)                     = 0<br />fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0<br />setsockopt(6, SOL_SOCKET, SO_PRIORITY, [6], 4) = 0<br />fcntl64(6, F_GETFL)                     = 0x2 (flags O_RDWR)<br />fcntl64(6, F_SETFL, O_RDWR|O_NONBLOCK)  = 0<br />connect(6, {sa_family=AF_FILE, path=&quot;/home/jstdio/.pulse/b0f5cbbcf4211dc7544066c04ac2621b-runtime/native&quot;}, 110) = 0<br />clock_gettime(CLOCK_MONOTONIC, {1337, 90290695}) = 0<br />write(2, &quot;AL lib: pulseaudio.c:391: starti&quot;..., 72AL lib: pulseaudio.c:391: starting pa_threaded_mainloop_wait() state: 1) = 72<br />futex(0xede8afc, FUTEX_WAIT_PRIVATE, 1, NULL) = 0<br />futex(0xede8bc0, FUTEX_LOCK_PI_PRIVATE, 1PA lib: thread-mainloop.c:225: inside pa_threaded_mainloop_signal() n_waiting_for_accept: 1) = 0<br />write(2, &quot;AL lib: pulseaudio.c:394: starti&quot;..., 74AL lib: pulseaudio.c:394: starting pa_threaded_mainloop_accept() state: 1) = 74<br />futex(0xee06b40, FUTEX_WAIT_PRIVATE, 2, NULL) = 0<br />futex(0xee06b44, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0xee06b40, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 0<br />write(2, &quot;AL lib: pulseaudio.c:391: starti&quot;..., 72AL lib: pulseaudio.c:391: starting pa_threaded_mainloop_wait() state: 2) = 72<br />futex(0xede8bc0, FUTEX_UNLOCK_PI_PRIVATE, -1217208332PA lib: thread-mainloop.c:228: PulseAudio ready to go) = 0<br />futex(0xede8afc, FUTEX_WAIT_PRIVATE, 3, NULL) = 0<br />futex(0xede8bc0, FUTEX_LOCK_PI_PRIVATE, 1PA lib: thread-mainloop.c:225: inside pa_threaded_mainloop_signal() n_waiting_for_accept: 1) = 0<br />write(2, &quot;AL lib: pulseaudio.c:394: starti&quot;..., 74AL lib: pulseaudio.c:394: starting pa_threaded_mainloop_accept() state: 2) = 74<br />futex(0xee06b40, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)<br />futex(0xee06b44, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0xee06b40, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1<br />write(2, &quot;AL lib: pulseaudio.c:391: starti&quot;..., 72AL lib: pulseaudio.c:391: starting pa_threaded_mainloop_wait() state: 3) = 72<br />futex(0xede8bc0, FUTEX_UNLOCK_PI_PRIVATE, -1217208332PA lib: thread-mainloop.c:228: PulseAudio ready to go) = 0<br />futex(0xede8af8, FUTEX_WAKE_PRIVATE, 1PA lib: thread-mainloop.c:225: inside pa_threaded_mainloop_signal() n_waiting_for_accept: 1) = 1<br />futex(0xede8afc, FUTEX_WAIT_PRIVATE, 5, NULL) = -1 EAGAIN (Resource temporarily unavailable)<br />write(2, &quot;AL lib: pulseaudio.c:394: starti&quot;..., 74AL lib: pulseaudio.c:394: starting pa_threaded_mainloop_accept() state: 3) = 74<br />futex(0xee06b44, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0xee06b40, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1<br />write(2, &quot;AL lib: pulseaudio.c:397: OpenAL&quot;..., 45AL lib: pulseaudio.c:397: OpenAL ready to go) = 45<br />futex(0xede8bc0, FUTEX_UNLOCK_PI_PRIVATE, -1217208332PA lib: thread-mainloop.c:228: PulseAudio ready to go) = 0<br />send(5, &quot;W&quot;, 1, MSG_NOSIGNAL)           = -1 ENOTSOCK (Socket operation on non-socket)<br />write(5, &quot;W&quot;, 1)                        = 1<br />close(6)                                = 0<br /><br /><span></span></p><p id="__paragraph__1263537492000" style="font-family:Verdana;">And Alien Arena continues to start as normal.<br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><br /></p><p id="__paragraph__1263537492000" style="font-family:Verdana;">This is the mod of the function used to get the information I obtained originally when I discovered/reported this bug via launchpad.<br /><span></span></p><p id="__paragraph__1263537492000" style="font-family:Verdana;"><span><br />void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {<br />    pa_assert(m);<br /><br />    pa_cond_signal(m-&gt;cond, 1);<br /><br />    if (wait_for_accept) {<br />        m-&gt;n_waiting_for_accept ++;<br /><br />        PA_PRINT(&quot;inside pa_threaded_mainloop_signal() n_waiting_for_accept: %d\n&quot;,<br />                m-&gt;n_waiting_for_accept);<br />        while (m-&gt;n_waiting_for_accept &gt; 0)<br />            pa_cond_wait(m-&gt;accept_cond, m-&gt;mutex);<br />        PA_PRINT(&quot;PulseAudio ready to go\n&quot;);<br />    }<br />}<br /><br /></span></p><p id="__paragraph__1263537205000" style="font-family:Verdana;"><br /><span></span></p><p id="__paragraph__1263537205000" style="font-family:Verdana;"><span>Regards<br /></span></p><p style="font-family:Verdana;"><font size="2"><div id="editor_signature"><p size="2">--</p></div></font></p><p style="font-family:Verdana;"><font size="2"><div id="editor_signature"><p size="2">Iain Buclaw<span></span></p><p id="__paragraph__1263536947000"><font size="2" style="font-family:Arial;"><span>tinivole [at] ubuntu [dot] com</span></font></p></div></font></p><p style="font-family:Verdana;"><font size="2"><div id="editor_signature"><p id="__paragraph__1263536947000"><font size="2" style="font-family:Arial;"><span></span></font></p></div></font></p><p style="font-family:Verdana;"></p></body></html>