<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 09.06.20 16:13, Chengyi Zhao wrote:<br>
</div>
<blockquote type="cite"
cite="mid:SG2PR03MB276735F6F4400CD6EAD314A899820@SG2PR03MB2767.apcprd03.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Hi Georg,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for your reply!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Hi all, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
I try to apply the following patch to fix this issue, please
help review, thanks!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</blockquote>
<p><br>
</p>
<p>Thanks for the patch. Because all patches have to go though
Gitlab,</p>
<p>can you please open a merge request on Gitlab?</p>
<p><a class="moz-txt-link-freetext" href="https://gitlab.freedesktop.org/pulseaudio/pulseaudio/">https://gitlab.freedesktop.org/pulseaudio/pulseaudio/</a></p>
<p><br>
</p>
<p>Two small comment below.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:SG2PR03MB276735F6F4400CD6EAD314A899820@SG2PR03MB2767.apcprd03.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<span>Date: Tue Jun 9 22:09:36 2020 +0800<br>
</span>
<div><br>
</div>
<div> srb: ignore srb when reading/writing srb generated an
exception<br>
</div>
<div> <br>
</div>
<div> When the function do_read() returns -1, the program
continues<br>
</div>
<div> reading the same srb, maybe it will occur the crash.<br>
</div>
<div><br>
</div>
<div>diff --git a/src/pulsecore/pstream.c
b/src/pulsecore/pstream.c<br>
</div>
<div>index 3b94a3adf..4fcec51c6 100644<br>
</div>
<div>--- a/src/pulsecore/pstream.c<br>
</div>
<div>+++ b/src/pulsecore/pstream.c<br>
</div>
<div>@@ -235,7 +235,7 @@ void
pa_cmsg_ancil_data_close_fds(struct pa_cmsg_ancil_data *ancil)
{<br>
</div>
<div> static int do_write(pa_pstream *p);<br>
</div>
<div> static int do_read(pa_pstream *p, struct pstream_read
*re);<br>
</div>
<div> <br>
</div>
<div>-static void do_pstream_read_write(pa_pstream *p) {<br>
</div>
<div>+static int do_pstream_read_write(pa_pstream *p) {<br>
</div>
<div> pa_assert(p);<br>
</div>
<div> pa_assert(PA_REFCNT_VALUE(p) > 0);<br>
</div>
<div> <br>
</div>
<div>@@ -244,8 +244,15 @@ static void
do_pstream_read_write(pa_pstream *p) {<br>
</div>
<div> p->mainloop->defer_enable(p->defer_event, 0);<br>
</div>
<div> <br>
</div>
<div> if (!p->dead && p->srb) {<br>
</div>
</div>
</blockquote>
<p>r should be defined here.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:SG2PR03MB276735F6F4400CD6EAD314A899820@SG2PR03MB2767.apcprd03.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<div>
</div>
<div>- do_write(p);<br>
</div>
<div>- while (!p->dead && do_read(p,
&p->readsrb) == 0);<br>
</div>
<div>+ if(do_write(p) < 0)<br>
</div>
<div>+ goto ignore;<br>
</div>
<div>+<br>
</div>
<div>+ int r = 0;<br>
</div>
</div>
</blockquote>
<blockquote type="cite"
cite="mid:SG2PR03MB276735F6F4400CD6EAD314A899820@SG2PR03MB2767.apcprd03.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<div>
</div>
<div>+ while (!p->dead && r == 0) {<br>
</div>
<div>+ r = do_read(p, &p->readsrb);<br>
</div>
<div>+ if (r < 0)<br>
</div>
<div>+ goto ignore;<br>
</div>
<div>+ }<br>
</div>
<div> }<br>
</div>
<div> <br>
</div>
<div> if (!p->dead &&
pa_iochannel_is_readable(p->io)) {<br>
</div>
<div>@@ -263,7 +270,12 @@ static void
do_pstream_read_write(pa_pstream *p) {<br>
</div>
<div> }<br>
</div>
<div> <br>
</div>
<div> pa_pstream_unref(p);<br>
</div>
<div>- return;<br>
</div>
<div>+ return 0;<br>
</div>
<div>+<br>
</div>
<div>+ignore:<br>
</div>
<div>+<br>
</div>
<div>+ pa_pstream_unref(p);<br>
</div>
<div>+ return -1;<br>
</div>
<div> <br>
</div>
<div> fail:<br>
</div>
<div> <br>
</div>
<div>@@ -272,9 +284,11 @@ fail:<br>
</div>
<div> <br>
</div>
<div> pa_pstream_unlink(p);<br>
</div>
<div> pa_pstream_unref(p);<br>
</div>
<div>+ return -1;<br>
</div>
<div> }<br>
</div>
<div> <br>
</div>
<div> static bool srb_callback(pa_srbchannel *srb, void
*userdata) {<br>
</div>
<div>+ int r;<br>
</div>
<div> bool b;<br>
</div>
<div> pa_pstream *p = userdata;<br>
</div>
<div> <br>
</div>
<div>@@ -284,11 +298,11 @@ static bool
srb_callback(pa_srbchannel *srb, void *userdata) {<br>
</div>
<div> <br>
</div>
<div> pa_pstream_ref(p);<br>
</div>
<div> <br>
</div>
<div>- do_pstream_read_write(p);<br>
</div>
<div>+ r = do_pstream_read_write(p);<br>
</div>
<div> <br>
</div>
<div> /* If either pstream or the srb is going away, return
false.<br>
</div>
<div> We need to check this before p is destroyed. */<br>
</div>
</div>
</blockquote>
<p>Please correct the comment, we now also fail if the read_write
failed.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:SG2PR03MB276735F6F4400CD6EAD314A899820@SG2PR03MB2767.apcprd03.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<div>
</div>
<div>- b = (PA_REFCNT_VALUE(p) > 1) && (p->srb
== srb);<br>
</div>
<div>+ b = (r == 0) && (PA_REFCNT_VALUE(p) > 1)
&& (p->srb == srb);<br>
</div>
<div> pa_pstream_unref(p);<br>
</div>
<div> <br>
</div>
<div> return b;<br>
</div>
<span></span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Chengyi</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b> Georg
Chini <a class="moz-txt-link-rfc2396E" href="mailto:georg@chini.tk"><georg@chini.tk></a><br>
<b>Sent:</b> Tuesday, June 9, 2020 2:01<br>
<b>To:</b> General PulseAudio Discussion
<a class="moz-txt-link-rfc2396E" href="mailto:pulseaudio-discuss@lists.freedesktop.org"><pulseaudio-discuss@lists.freedesktop.org></a>; Zhao Chengyi
<a class="moz-txt-link-rfc2396E" href="mailto:chengyi.zhao@outlook.com"><chengyi.zhao@outlook.com></a><br>
<b>Subject:</b> Re: [pulseaudio-discuss] 回复: How to fix
pulseaudio crash when playing music</font>
<div> </div>
</div>
<div>
<div class="x_moz-cite-prefix">On 09.06.20 10:39, Zhao Chengyi
wrote:<br>
</div>
<blockquote type="cite">
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Please ignore the gdb bt information above because of
error dbgsyms, </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
and please refer to the following <span
style="color:rgb(0,0,0);
font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt">logs when occurring crash.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0);
font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0);
font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt"><span>5月 26 03:14:24 test-PC
pulseaudio[2841]: W: [pulseaudio] pstream.c: Received
SHM memblock frame with invalid frame length.<br>
</span>
<div>5月 26 03:14:24 test-PC pulseaudio[2841]: E:
[pulseaudio] pstream.c: Assertion 're->data ||
re->memblock' failed at pulsecore/pstream.c:862,
function do_read(). Aborting.<br>
</div>
<div>5月 26 03:14:24 test-PC systemd[1]: Created slice
system-systemd\x2dcoredump.slice.<br>
</div>
<div>5月 26 03:14:24 test-PC systemd[1]: Started Process
Core Dump (PID 10183/UID 0).<br>
</div>
<div>5月 26 03:14:25 test-PC bluetoothd[1700]: Endpoint
unregistered: sender=:1.60
path=/MediaEndpoint/A2DPSource<br>
</div>
<div>5月 26 03:14:25 test-PC bluetoothd[1700]: Endpoint
unregistered: sender=:1.60 path=/MediaEndpoint/A2DPSink<br>
</div>
<div>5月 26 03:14:25 test-PC daemon/audio[2874]:
audio_events.go:65: pulseaudio context state failed<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]:
pulseaudio.service: Main process exited, code=dumped,
status=6/ABRT<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]:
pulseaudio.service: Failed with result 'core-dump'.<br>
</div>
<div>5月 26 03:14:25 test-PC systemd-coredump[10184]:
Process 2841 (pulseaudio) of user 1000 dumped core.<br>
</div>
<div> <br>
</div>
<div>
Stack trace of thread 2841:<br>
</div>
<div> #0
0x0000ffff8702a714 raise (libc.so.6)<br>
</div>
<div> #1
0x0000ffff870188e8 abort (libc.so.6)<br>
</div>
<div> #2
0x0000ffff873b5728 n/a (libpulsecommon-12.2.so)<br>
</div>
<div> #3
0x0000ffff873b7fd8 n/a (libpulsecommon-12.2.so)<br>
</div>
<div> #4
0x0000ffff873b8368 n/a (libpulsecommon-12.2.so)<br>
</div>
<div> #5
0x0000ffff873b8bec n/a (libpulsecommon-12.2.so)<br>
</div>
<div> #6
0x0000ffff87339c70 pa_mainloop_dispatch (libpulse.so.0)<br>
</div>
<div> #7
0x0000ffff8733a01c pa_mainloop_iterate (libpulse.so.0)<br>
</div>
<div> #8
0x0000ffff8733a0d8 pa_mainloop_run (libpulse.so.0)<br>
</div>
<div> #9
0x0000000000406894 main (pulseaudio)<br>
</div>
<div> #10
0x0000ffff87018d24 __libc_start_main (libc.so.6)<br>
</div>
<div> #11
0x00000000004076c4 _start (pulseaudio)<br>
</div>
<div> #12
0x00000000004076c4 _start (pulseaudio)<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]:
pulseaudio.service: Service RestartSec=100ms expired,
scheduling restart.<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]:
pulseaudio.service: Scheduled restart job, restart
counter is at 1.<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]: Stopped Sound
Service.<br>
</div>
<div>5月 26 03:14:25 test-PC systemd[2674]: Starting Sound
Service...<br>
</div>
<span>5月 26 03:14:25 test-PC pulseaudio[10197]: W:
[pulseaudio] pid.c: Stale PID file, overwriting.</span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Best Regards,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Chengyi</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font
style="font-size:11pt" face="Calibri, sans-serif"
color="#000000"><b>发件人:</b> Zhao Chengyi<br>
<b>发送时间:</b> 2020年6月9日 0:30<br>
<b>收件人:</b> <a class="x_moz-txt-link-abbreviated"
href="mailto:pulseaudio-discuss@lists.freedesktop.org"
moz-do-not-send="true">
pulseaudio-discuss@lists.freedesktop.org</a> <a
class="x_moz-txt-link-rfc2396E"
href="mailto:pulseaudio-discuss@lists.freedesktop.org"
moz-do-not-send="true">
<pulseaudio-discuss@lists.freedesktop.org></a><br>
<b>主题:</b> How to fix pulseaudio crash when playing music</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
I found pulseaudio crash when playing music, please help
fix this issue, thanks a lot!</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
please refer to the following gdb information when
occurring crash:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
<span>[Current thread is 1 (Thread 0xffff86823010 (LWP
2841))]<br>
</span>
<div>(gdb) bt<br>
</div>
<div>#0 0x0000ffff8702a714 in __GI_raise
(sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:50<br>
</div>
<div>#1 0x0000ffff870188e8 in __GI_abort () at abort.c:79<br>
</div>
<div>#2 0x0000ffff873b5728 in do_read
(p=p@entry=0x3673a170, re=re@entry=0x3673a338) at
pulsecore/pstream.c:856<br>
</div>
<div>#3 0x0000ffff873b7fd8 in do_pstream_read_write
(p=0x3673a170) at pulsecore/pstream.c:248<br>
</div>
<div>#4 0x0000ffff873b8368 in srb_callback
(srb=<optimized out>, userdata=0x3673a170) at
pulsecore/pstream.c:287<br>
</div>
<div>#5 0x0000ffff873b8bec in srbchannel_rwloop
(sr=0x36766ae0) at pulsecore/srbchannel.c:190<br>
</div>
<div>#6 0x0000ffff87339c70 in dispatch_pollfds
(m=0x36670db0) at pulse/mainloop.c:655<br>
</div>
<div>#7 0x0000ffff87339c70 in pa_mainloop_dispatch
(m=m@entry=0x36670db0) at pulse/mainloop.c:898<br>
</div>
<div>#8 0x0000ffff8733a01c in pa_mainloop_iterate
(m=0x36670db0, block=<optimized out>,
retval=0xffffd9683030) at pulse/mainloop.c:929<br>
</div>
<div>#9 0x0000ffff8733a0d8 in pa_mainloop_run
(m=m@entry=0x36670db0,
retval=retval@entry=0xffffd9683030) at
pulse/mainloop.c:945<br>
</div>
<div>#10 0x0000000000406894 in main (argc=<optimized
out>, argv=<optimized out>) at
daemon/main.c:1144<br>
</div>
<span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Best Regards,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;
font-size:12pt; color:rgb(0,0,0)">
Chengyi</div>
</div>
</blockquote>
<p>Hi,</p>
<p><br>
</p>
<p>there is a bug report on Gitlab which describes exactly the
same problem:<br>
<br>
<a class="x_moz-txt-link-freetext"
href="https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/859"
moz-do-not-send="true">https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/859</a></p>
<p><br>
</p>
<p>Unfortunately we did not yet have the time to investigate
further.</p>
<p><br>
</p>
<p>Regards</p>
<p> Georg<br>
</p>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>