Skip to contentSkip to conversation

snd_pcm_drain and lockups

DISCUSSION Arve Knudsen 2 participants 5 messages Sep 4, 2007 – Sep 6, 2007

lore
Share & tools
lore
#0 lore raw

Hello

Users of the PortAudio library on top of ALSA-lib have reported that it may hang in a call to snd_pcm_drain. I have also been able to confirm that this can happen in conjunction with the dmix device at least. Can the ALSA developers please tell me how, if at all, snd_pcm_drain may be safely used? Is this function simply best avoided (snd_pcm_drop being the alternative)?

Thanks,
Arve Knudsen

#1 lore raw

At Tue, 4 Sep 2007 23:03:27 +0200,

Quoted 8 lines · Arve Knudsen

Hello

Users of the PortAudio library on top of ALSA-lib have reported that it may hang in a call to snd_pcm_drain. I have also been able to confirm that this can happen in conjunction with the dmix device at least. Can the ALSA developers please tell me how, if at all, snd_pcm_drain may be safely used? Is this function simply best avoided (snd_pcm_drop being the alternative)?

Of course, it's supposed to be safe to use :) But, it's hard to tell you more unless I get the details in your case...

In which situation is it called? Are they multi-threaded?

Takashi

#2 lore raw

Hi Takashi

Quoted 12 lines · Takashi Iwai

At Tue, 4 Sep 2007 23:03:27 +0200,

Quoted 4 lines · Arve Knudsen

Hello

Users of the PortAudio library on top of ALSA-lib have reported that it

may

Quoted 1 line

hang in a call to snd_pcm_drain. I have also been able to confirm that

this

Quoted 2 lines

can happen in conjunction with the dmix device at least. Can the ALSA developers please tell me how, if at all, snd_pcm_drain may be safely

Quoted 8 lines

used?

Quoted 1 line

Is this function simply best avoided (snd_pcm_drop being the

alternative)?

Of course, it's supposed to be safe to use :) But, it's hard to tell you more unless I get the details in your case...

In which situation is it called? Are they multi-threaded?

The lock-up happens in a background thread within PortAudio. What has been known to cause lock-ups at least is that PA restarts the device after the detection of an xrun. This procedure entails first draining the stream (snd_pcm_drain), the dmix and front devices have been known to lock up here (I've experienced it with dmix at least). I've googled a bit on the problem, and I didn't find a whole lot of evidence of this problem, but I did find
this: http://www.ohloh.net/projects/5344/contributors/32264/commits/10293341
.

Arve

#3 lore raw

At Wed, 5 Sep 2007 19:19:10 +0200,

Quoted 26 lines · Arve Knudsen

Hi Takashi

Quoted 12 lines · Takashi Iwai

At Tue, 4 Sep 2007 23:03:27 +0200,

Quoted 4 lines · Arve Knudsen

Hello

Users of the PortAudio library on top of ALSA-lib have reported that it

may

Quoted 1 line

hang in a call to snd_pcm_drain. I have also been able to confirm that

this

Quoted 2 lines

can happen in conjunction with the dmix device at least. Can the ALSA developers please tell me how, if at all, snd_pcm_drain may be safely

Quoted 8 lines

used?

Quoted 1 line

Is this function simply best avoided (snd_pcm_drop being the

alternative)?

Of course, it's supposed to be safe to use :) But, it's hard to tell you more unless I get the details in your case...

In which situation is it called? Are they multi-threaded?

Quoted 8 lines

The lock-up happens in a background thread within PortAudio. What has been known to cause lock-ups at least is that PA restarts the device after the detection of an xrun. This procedure entails first draining the stream (snd_pcm_drain), the dmix and front devices have been known to lock up here (I've experienced it with dmix at least). I've googled a bit on the problem, and I didn't find a whole lot of evidence of this problem, but I did find
this: http://www.ohloh.net/projects/5344/contributors/32264/commits/10293341
.

It's still hard to imagine what's going on there without a small test case. I vaguely remember a similar problem, but I thought it should have been fixed in the recent versions.

Takashi

#4 lore raw
Quoted 43 lines · Takashi Iwai

At Wed, 5 Sep 2007 19:19:10 +0200,

Quoted 11 lines · Arve Knudsen

Hi Takashi

Quoted 7 lines · Takashi Iwai

At Tue, 4 Sep 2007 23:03:27 +0200,

Quoted 4 lines · Arve Knudsen

Hello

Users of the PortAudio library on top of ALSA-lib have reported that

it

Quoted 2 lines
Quoted 2 lines

may

Quoted 1 line

hang in a call to snd_pcm_drain. I have also been able to confirm

that

Quoted 2 lines
Quoted 2 lines

this

Quoted 1 line

can happen in conjunction with the dmix device at least. Can the

ALSA

Quoted 1 line
Quoted 1 line
Quoted 1 line

developers please tell me how, if at all, snd_pcm_drain may be

safely

Quoted 11 lines
Quoted 8 lines

used?

Quoted 1 line

Is this function simply best avoided (snd_pcm_drop being the

alternative)?

Of course, it's supposed to be safe to use :) But, it's hard to tell you more unless I get the details in your case...

In which situation is it called? Are they multi-threaded?

The lock-up happens in a background thread within PortAudio. What has

been

Quoted 1 line

known to cause lock-ups at least is that PA restarts the device after

the

Quoted 2 lines

detection of an xrun. This procedure entails first draining the stream (snd_pcm_drain), the dmix and front devices have been known to lock up

here

Quoted 1 line

(I've experienced it with dmix at least). I've googled a bit on the

problem,

Quoted 1 line

and I didn't find a whole lot of evidence of this problem, but I did

Quoted 8 lines

find

Quoted 1 line

this:

http://www.ohloh.net/projects/5344/contributors/32264/commits/10293341

Quoted 1 line

.

It's still hard to imagine what's going on there without a small test case. I vaguely remember a similar problem, but I thought it should have been fixed in the recent versions.

I can try to procure a test case, but I believe it happens rather randomly.

Arve