[Re: Crash when snd_pcm_open is called from a thread with "pulse" as playback]
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 ?
**********************************
#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: [email protected] Date: Mer 4 mars 2009 8:20
À: [email protected]
--------------------------------------------------------------------------
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
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Sun, 8 Mar 2009 16:11:45 -0000 (GMT),
Quoted 13 lines · [email protected] 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=4426We'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.
Quoted 6 lines
Questions are:
Should
config_update_free_globalNOT 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
Quoted 74 lines
**********************************
#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 whensnd_pcm_openis called from a thread with "pulse" as
playbackDe: [email protected] Date: Mer 4 mars 2009 8:20À: [email protected]
--------------------------------------------------------------------------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_tsdHowever, AFAIK, one should be able to call
snd_pcm_openfrom a thread.The full bug report is there, with a very simple sample code :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426I think this bug relates directly to alsa.
I hope this report is useful.Best-
Nicolas_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 15 lines · Takashi Iwai
At Sun, 8 Mar 2009 16:11:45 -0000 (GMT),
Quoted 13 lines · [email protected] 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=4426We'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.
Quoted 8 lines
Quoted 6 lines
Questions are:
Should
config_update_free_globalNOT 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...
I would suggest to comment out code from snd_config_update_free_global(). Try to comment out snd_dlobj_cache_cleanup() at first. You may compile alsa-lib from the tar ball on www.alsa-project.org and use LD_PRELOAD=alsa-lib/src/.libs/libasound.so.2.0.0 <your_program> for tests.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
Hi Jaroslav, Takashi and all,
thx for you answers.
Takashi :
Quoted 1 line
Hm, I don't see any reason, and I cannot reproduce a crash on my machine...
I can reproduce it on my three Fedora10 machines, using 2 hardware.
Jaroslav
Quoted 4 lines
I would suggest to comment out code from
snd_config_update_free_global(). Try to comment outsnd_dlobj_cache_cleanup()at first. You may compile alsa-lib from the tar ball on www.alsa-project.org and use LD_PRELOAD=alsa-lib/src/.libs/libasound.so.2.0.0 <your_program> for tests.
Done.
* First, no more bug when commenting snd_dlobj_cache_cleanup
* Also, no more bug when commenting dlclose
in snd_dlclose
called from snd_dlobj_cache_cleanup
The only dynamically loaded lib is _snd_pcm_pulse_open
Seems once again that pulse is involved somewhere.
But dunno where to look at from this point :/
I upload these new inputs on the tracker.
Best-
Nicolas
Quoted 45 lines · Takashi Iwai
Quoted 19 lines
At Sun, 8 Mar 2009 16:11:45 -0000 (GMT),
Quoted 9 lines · [email protected] 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=4426We've made a few progress on it, but we are stuck again.
Basically, it seems that calling
snd_config_update_free_global()froma
Quoted 6 lines
pthread causes the program to crash when the thread terminates.
Questions are:
Quoted 7 lines
Quoted 4 lines
Should
config_update_free_globalNOT 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...
I would suggest to comment out code from
snd_config_update_free_global(). Try to comment outsnd_dlobj_cache_cleanup()at first. You may compile alsa-lib from the tar ball on www.alsa-project.org and use LD_PRELOAD=alsa-lib/src/.libs/libasound.so.2.0.0 <your_program> for tests.Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc._______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 26 lines · On Mon, 9 Mar 2009 [email protected] wrote:
Hi Jaroslav, Takashi and all,
thx for you answers.
Takashi :
Quoted 1 line
Hm, I don't see any reason, and I cannot reproduce a crash on my machine...
I can reproduce it on my three Fedora10 machines, using 2 hardware.
Jaroslav
Quoted 4 lines
I would suggest to comment out code from
snd_config_update_free_global(). Try to comment outsnd_dlobj_cache_cleanup()at first. You may compile alsa-lib from the tar ball on www.alsa-project.org and use LD_PRELOAD=alsa-lib/src/.libs/libasound.so.2.0.0 <your_program> for tests.Done.
* First, no more bug when commenting
snd_dlobj_cache_cleanup* Also, no more bug when commenting dlclose
insnd_dlclose
called fromsnd_dlobj_cache_cleanup
Quoted 4 lines
The only dynamically loaded lib is
_snd_pcm_pulse_openSeems once again that pulse is involved somewhere.
Maybe. I guess it's a glibc bug which might be Fedora specific. Could you try glibc from different distribution (or maybe rawhide) using LD_PRELOAD hack if this bug can be reproduced? Just unpack glibc rpm with rpm2cpio and use libc.so, libdl.so and libphread.so files for LD_PRELOAD.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
Hi Jaroslav & all,
Quoted 4 lines
Maybe. I guess it's a glibc bug which might be Fedora specific. Could you try glibc from different distribution (or maybe rawhide) using
LD_PRELOADhack if this bug can be reproduced? Just unpack glibc rpm with rpm2cpio and use libc.so, libdl.so and libphread.so files forLD_PRELOAD.
Well, these are manipulations I am not used to :(
In particular, I never installed rawhide.
But I tried the pre compiled libraries in http://download.fedora.redhat.com
then used the downloaded libc.so, libdl.so and libphread.so at run time.
-> Fedora development version glibc-2.9.90-8.1.i686.rpm Newer than mine. Found in :
http://download.fedora.redhat.com/pub/fedora/linux/development/i386/os/Packages/
-> Fedora release version glibc-2.9-2.i686.rpm
Older than mine. Found in :
http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/i386/os/Packages/
The bug is still there with both these versions.
I've tried using another glibc (eg ubuntu), but I must say I have difficulties looking into them...
Perhaps someone has Fedora Rawhide installed, and could test ?
If this is possible he sample program is alsa_main.cpp, available at :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426
Cheers,
Nicolas
Quoted 53 lines · On Mon, 9 Mar 2009 [email protected] wrote:
Quoted 30 lines
Hi Jaroslav, Takashi and all,
thx for you answers.
Takashi :
Quoted 1 line
Hm, I don't see any reason, and I cannot reproduce a crash on my
machine...
I can reproduce it on my three Fedora10 machines, using 2 hardware.
Jaroslav
Quoted 1 line
I would suggest to comment out code from
snd_config_update_free_global().Quoted 3 lines
Try to comment out
snd_dlobj_cache_cleanup()at first. You may compile alsa-lib from the tar ball on www.alsa-project.org and use LD_PRELOAD=alsa-lib/src/.libs/libasound.so.2.0.0 <your_program> fortests.
Done.
* First, no more bug when commenting
snd_dlobj_cache_cleanup* Also, no more bug when commenting dlclose
insnd_dlclose
called fromsnd_dlobj_cache_cleanupQuoted 4 lines
The only dynamically loaded lib is
_snd_pcm_pulse_openSeems once again that pulse is involved somewhere.
Maybe. I guess it's a glibc bug which might be Fedora specific. Could you try glibc from different distribution (or maybe rawhide) using
LD_PRELOADhack if this bug can be reproduced? Just unpack glibc rpm with rpm2cpio and use libc.so, libdl.so and libphread.so files forLD_PRELOAD.Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc._______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel