From: Takashi Iwai Subject: Re: snd_pcm_drain and lockups Date: Thu, 06 Sep 2007 15:54:54 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx1.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 2D322103904 for ; Thu, 6 Sep 2007 15:54:55 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Arve Knudsen Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 5 Sep 2007 19:19:10 +0200, Arve Knudsen wrote: > > Hi Takashi > > On 9/5/07, Takashi Iwai wrote: > > > > At Tue, 4 Sep 2007 23:03:27 +0200, > > Arve Knudsen wrote: > > > > > > 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? > > > 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