Hi Georg,
Thanks for your reply!
Hi all,
I try to apply the following patch to fix this issue, please help review, thanks!
Date: Tue Jun 9 22:09:36 2020 +0800
srb: ignore srb when reading/writing srb generated an exception
When the function do_read() returns -1, the program continues
reading the same srb, maybe it will occur the crash.
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 3b94a3adf..4fcec51c6 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -235,7 +235,7 @@ void pa_cmsg_ancil_data_close_fds(struct pa_cmsg_ancil_data *ancil) {
static int do_write(pa_pstream *p);
static int do_read(pa_pstream *p, struct pstream_read *re);
-static void do_pstream_read_write(pa_pstream *p) {
+static int do_pstream_read_write(pa_pstream *p) {
pa_assert(p);
pa_assert(PA_REFCNT_VALUE(p) > 0);
@@ -244,8 +244,15 @@ static void do_pstream_read_write(pa_pstream *p) {
p->mainloop->defer_enable(p->defer_event, 0);
if (!p->dead && p->srb) {
- do_write(p);
- while (!p->dead && do_read(p, &p->readsrb) == 0);
+ if(do_write(p) < 0)
+ goto ignore;
+
+ int r = 0;
+ while (!p->dead && r == 0) {
+ r = do_read(p, &p->readsrb);
+ if (r < 0)
+ goto ignore;
+ }
}
if (!p->dead && pa_iochannel_is_readable(p->io)) {
@@ -263,7 +270,12 @@ static void do_pstream_read_write(pa_pstream *p) {
}
pa_pstream_unref(p);
- return;
+ return 0;
+
+ignore:
+
+ pa_pstream_unref(p);
+ return -1;
fail:
@@ -272,9 +284,11 @@ fail:
pa_pstream_unlink(p);
pa_pstream_unref(p);
+ return -1;
}
static bool srb_callback(pa_srbchannel *srb, void *userdata) {
+ int r;
bool b;
pa_pstream *p = userdata;
@@ -284,11 +298,11 @@ static bool srb_callback(pa_srbchannel *srb, void *userdata) {
pa_pstream_ref(p);
- do_pstream_read_write(p);
+ r = do_pstream_read_write(p);
/* If either pstream or the srb is going away, return false.
We need to check this before p is destroyed. */
- b = (PA_REFCNT_VALUE(p) > 1) && (p->srb == srb);
+ b = (r == 0) && (PA_REFCNT_VALUE(p) > 1) && (p->srb == srb);
pa_pstream_unref(p);
return b;
Best Regards,
Chengyi
From: Georg Chini <georg@xxxxxxxx>
Sent: Tuesday, June 9, 2020 2:01 To: General PulseAudio Discussion <pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx>; Zhao Chengyi <chengyi.zhao@xxxxxxxxxxx> Subject: Re: 回复: How to fix pulseaudio crash when playing music On 09.06.20 10:39, Zhao Chengyi wrote:
Hi,
there is a bug report on Gitlab which describes exactly the same problem:
Unfortunately we did not yet have the time to investigate further.
Regards Georg |
_______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss