public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin()
@ 2009-08-16 22:24 Daniel Chen
  2009-08-17  6:49 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Chen @ 2009-08-16 22:24 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

Hi,

In https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/412677
we're debugging an issue where snd_pcm_mmap_begin(), at line 6409 with

*offset = *pcm->appl.ptr % pcm->buffer_size;

appears to have pcm->buffer_size == 0. What's the correct approach in
handling this corner case?

Thanks,
Dan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin()
  2009-08-16 22:24 Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin() Daniel Chen
@ 2009-08-17  6:49 ` Takashi Iwai
  2009-08-17 14:36   ` Lennart Poettering
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2009-08-17  6:49 UTC (permalink / raw)
  To: Daniel Chen; +Cc: alsa-devel

At Sun, 16 Aug 2009 18:24:35 -0400,
Daniel Chen wrote:
> 
> Hi,
> 
> In https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/412677
> we're debugging an issue where snd_pcm_mmap_begin(), at line 6409 with
> 
> *offset = *pcm->appl.ptr % pcm->buffer_size;
> 
> appears to have pcm->buffer_size == 0. What's the correct approach in
> handling this corner case?

We could add a sanity check in the function, of course.
But relying on it doesn't sound nice.

At least, the caller should be surely at the certain state that the
buffer has been set up, i.e. checking whether snd_pcm_state() returns
SETUP or better condition.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin()
  2009-08-17  6:49 ` Takashi Iwai
@ 2009-08-17 14:36   ` Lennart Poettering
  2009-08-17 16:16     ` Daniel Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Poettering @ 2009-08-17 14:36 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Daniel Chen

On Mon, 17.08.09 08:49, Takashi Iwai (tiwai@suse.de) wrote:

> 
> At Sun, 16 Aug 2009 18:24:35 -0400,
> Daniel Chen wrote:
> > 
> > Hi,
> > 
> > In https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/412677
> > we're debugging an issue where snd_pcm_mmap_begin(), at line 6409 with
> > 
> > *offset = *pcm->appl.ptr % pcm->buffer_size;
> > 
> > appears to have pcm->buffer_size == 0. What's the correct approach in
> > handling this corner case?
> 
> We could add a sanity check in the function, of course.
> But relying on it doesn't sound nice.
> 
> At least, the caller should be surely at the certain state that the
> buffer has been set up, i.e. checking whether snd_pcm_state() returns
> SETUP or better condition.

Hmm, this bug is triggered in PA apparently. PA doesn't call
snd_pcm_mmap_begin() before the setup finished completely. Not sure
what's going on here, but this smells as if pcm->buffer_size is not
properly initialized.

Daniel, does this happen right-away on PA startup? Or does it
happen sometime while playing?

Could you get us the output of the PA startup phase when running
"pulsaudio -vvvv"? This should show us to which value the buffer_size
is initialized in the snd_pcm_t.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin()
  2009-08-17 14:36   ` Lennart Poettering
@ 2009-08-17 16:16     ` Daniel Chen
  2009-08-17 16:38       ` Lennart Poettering
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Chen @ 2009-08-17 16:16 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai, Daniel Chen

Hi Lennart,

On Mon, Aug 17, 2009 at 10:36 AM, Lennart Poettering<mznyfn@0pointer.de> wrote:
> Could you get us the output of the PA startup phase when running
> "pulsaudio -vvvv"? This should show us to which value the buffer_size
> is initialized in the snd_pcm_t.

The requested debug output is available at
http://launchpadlibrarian.net/30422583/pulseaudio .

Thanks,
Dan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin()
  2009-08-17 16:16     ` Daniel Chen
@ 2009-08-17 16:38       ` Lennart Poettering
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Poettering @ 2009-08-17 16:38 UTC (permalink / raw)
  To: Daniel Chen; +Cc: Takashi Iwai, alsa-devel

On Mon, 17.08.09 12:16, Daniel Chen (seven.steps@gmail.com) wrote:

> 
> Hi Lennart,
> 
> On Mon, Aug 17, 2009 at 10:36 AM, Lennart Poettering<mznyfn@0pointer.de> wrote:
> > Could you get us the output of the PA startup phase when running
> > "pulsaudio -vvvv"? This should show us to which value the buffer_size
> > is initialized in the snd_pcm_t.
> 
> The requested debug output is available at
> http://launchpadlibrarian.net/30422583/pulseaudio .

Hmm, that output shows that buffer_size is initialized to 16384, and
the SIGFPE is not thrown.

Could you please reproduce this issue and tell us what buffer_size is
then?

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-17 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-16 22:24 Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin() Daniel Chen
2009-08-17  6:49 ` Takashi Iwai
2009-08-17 14:36   ` Lennart Poettering
2009-08-17 16:16     ` Daniel Chen
2009-08-17 16:38       ` Lennart Poettering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox