From: Jaroslav Kysela <perex@perex.cz>
To: alsa-devel@alsa-project.org
Cc: sergemp@mail.ru
Subject: Re: [RFC][PATCH 0/2] Fix aplay and alsa-lib write_areas() freezing with 100% cpu usage on stuck slave pcm
Date: Fri, 13 Jun 2014 11:05:24 +0200 [thread overview]
Message-ID: <539ABED4.9000105@perex.cz> (raw)
In-Reply-To: <1402642371.496174944@f39.i.mail.ru>
Date 13.6.2014 08:52, Sergey wrote:
> These patches originate from `aplay -vvv /dev/zero` not responding to Ctrl+C
> when playing to plugged "null", e.g.
> pcm.!default {
> type plug
> slave.pcm { type null }
> slave.format S32_LE
> }
>
> First patch fixes snd_pcm_write_areas() stuck in a loop because of transfer
> func() always returning 0. That caused application calling it to freeze.
> In the example above it have frozen aplay. If it was called by firefox,
> it would freeze firefox.
>
> Is it a good way to fix it? Should snd_pcm_read_areas() be fixed like that too?
Nope: The whole culprit was in the null plugin - the stream was not
started, thus new samples were not delivered.
I tried to fix this in:
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=9c3086fb749cd5545be3f15cdde1592390006258
> Second patch fixes aplay itself, not returning from pcm_write() after SIGINT.
Thanks, looks good, but I added the in_aborting check to other
functions, too:
http://git.alsa-project.org/?p=alsa-utils.git;a=commit;h=c06dbf077459923066c96556678835cd1f55123a
> Additionally aplay may restore original interrupt handler, to make
> second Ctrl+C stop it for sure. In case of other bugs in alsa-lib or
> third-party slave pcms it seems better than SIGkilling it manually.
>
> Comments and suggestions are welcome.
>
> Regardless of these patches' fate null plugin must be fixed on its own.
>
> Patches (2):
> pcm: break out of snd_pcm_write_areas() if write function returned 0
> aplay: Escape from pcm_write() when in_aborting state
>
> src/pcm/pcm.c | 2 +-
> aplay/aplay.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
--
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
next prev parent reply other threads:[~2014-06-13 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 6:52 [RFC][PATCH 0/2] Fix aplay and alsa-lib write_areas() freezing with 100% cpu usage on stuck slave pcm Sergey
2014-06-13 6:58 ` [PATCH 1/2] pcm: break out of snd_pcm_write_areas() if write function returned 0 Sergey
2014-06-13 6:59 ` [PATCH 2/2] aplay: Escape from pcm_write() when in_aborting state Sergey
2014-06-13 9:05 ` Jaroslav Kysela [this message]
2014-06-13 12:13 ` [RFC][PATCH 0/2] Fix aplay and alsa-lib write_areas() freezing with 100% cpu usage on stuck slave pcm Sergey
2014-06-13 17:20 ` Jaroslav Kysela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=539ABED4.9000105@perex.cz \
--to=perex@perex.cz \
--cc=alsa-devel@alsa-project.org \
--cc=sergemp@mail.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.