[alsa-devel] [Re: Crash when snd_pcm_open is called from a thread with "pulse" as playback]

Takashi Iwai tiwai at suse.de
Mon Mar 9 14:18:49 CET 2009


At Sun, 8 Mar 2009 16:11:45 -0000 (GMT),
Nicolas.Castagne at imag.fr wrote:
> 
> Hi folks,
> 
> I'd need the help of some alsa developpers regarding the bug report :
> https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426
> 
> We've made a few progress on it, but we are stuck again.
> 
> Basically, it seems that calling snd_config_update_free_global() from a
> pthread causes the program to crash when the thread terminates.
> 
> 
> 
> Questions are:
> 
> Should config_update_free_global NOT be called from a thread ?
> 
> In other words, is the following code valid (though dumb :=)) ?
> Or is there some reason for it to crash ?

Hm, I don't see any reason, and I cannot reproduce a crash on my machine...


Takashi

> 
> 
> 
> **********************************
> #include <pthread.h>
> #include <alsa/asoundlib.h>
> void * threadWork(void *arg) {
>     snd_pcm_t *playback_handle;
>     if (snd_pcm_open (&playback_handle, "default",
> SND_PCM_STREAM_PLAYBACK, 0) < 0)
>         fprintf (stderr, "error\n";
>     snd_pcm_close(playback_handle);
> 
>     snd_config_update_free_global();
>     return NULL;
> }
> int main() {
>     pthread_attr_t attr;
>     pthread_attr_init(&attr);
>     pthread_t threadid;
>     pthread_create( &threadid, &attr, threadWork, NULL);
>     return EXIT_SUCCESS;
> }
> **********************************
> 
> 
> I thank you much,
> 
> Nicolas
> 
> 
> 
> 
> 
> ---------------------------- Message original ----------------------------
> Objet:    Crash when snd_pcm_open is called from a thread with "pulse" as 
>     playback
> De:       castagne at imag.fr
> Date:     Mer 4 mars 2009 8:20
> À:       alsa-devel at alsa-project.org
> --------------------------------------------------------------------------
> 
> Hi folks,
> 
> I hope I post on the correct mail list...
> I've read somewhere that I should report bugs on a list, and not only on
> the Tracker. That's the aim of this message.
> 
> 
> On all my Fedora 10 machines,
> whenever
>        snd_pcm_open
> has been called from a pthread using "pulse" as playback
> then the program crashes when the thread terminates.
> 
> Crash in __nptl_deallocate_tsd
> 
> However, AFAIK, one should be able to call snd_pcm_open from a thread.
> 
> The full bug report is there, with a very simple sample code :
> https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426
> 
> I think this bug relates directly to alsa.
> I hope this report is useful.
> 
> 
> Best-
> Nicolas
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


More information about the Alsa-devel mailing list