Bug 482797 - Seg fault using pthread, snd_pcm_open, and "pulse" playback
Summary: Seg fault using pthread, snd_pcm_open, and "pulse" playback
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: 10
Hardware: i386
OS: Linux
low
urgent
Target Milestone: ---
Assignee: Jaroslav Kysela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 490196 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-28 09:07 UTC by Catagne
Modified: 2009-09-07 22:36 UTC (History)
8 users (show)

Fixed In Version:
Clone Of: 477203
Environment:
Last Closed: 2009-09-07 22:36:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Sample program that causes the segfault (2.50 KB, text/plain)
2009-01-28 09:07 UTC, Catagne
no flags Details
gdb trace (354 bytes, text/plain)
2009-01-28 09:07 UTC, Catagne
no flags Details
Very simple sample code, with snd_pcm_open (2.74 KB, application/octet-stream)
2009-02-26 11:45 UTC, Catagne
no flags Details
New sample program (20.00 KB, application/x-tar)
2009-03-05 13:10 UTC, Catagne
no flags Details

Description Catagne 2009-01-28 09:07:21 UTC
Created attachment 330214 [details]
Sample program that causes the segfault

Description of problem:
When using the pthread library along with portaudio, program seg faults on fedora 10.


How reproducible:
Always, on two i386 machines, with various versions of portaudio v19.


Additional info:
A sample program demonstrating the bug is included.

This program seg faults on all my Fedora10 machines, inside __nptl_deallocate_tsd.


It runs OK on all my other linux machines (eg ubuntu, debian).

I've tested various versions of portaudio, eg :
- the redhat portaudio package V19-devel (built Dec 10 2008)
- the latest snapshot available on http://www.portaudio.com/ V19-devel (built Jan 26 2009)
- an older version version I had (built 20/06/2008)

All these versions of portaudio lead to the same seg faults on Fedora 10.
I bet it may be due to a problem in some packages in fedora 10.

This bug may relate to https://bugzilla.redhat.com/show_bug.cgi?id=477203, but I am unsure.

Comment 1 Catagne 2009-01-28 09:07:56 UTC
Created attachment 330215 [details]
gdb trace

Comment 2 Catagne 2009-02-26 11:43:53 UTC
I've looked further into the bug.

It turns out that the problem originates in alsa's 
      snd_pcm_open
when opening the playback device
      "pulse"


Included a newer, very very simple sample code.

Hope this helps.

Comment 3 Catagne 2009-02-26 11:45:23 UTC
Created attachment 333317 [details]
Very simple sample code, with snd_pcm_open

Very simple sample code, demonstrating that the bug originate in
      snd_pcm_open
when using "pulse" playback.

Comment 4 Eric Moret 2009-02-26 18:05:49 UTC
Could you please open a bug with upstream and post the upstream bug number here for monitoring.

Comment 5 Catagne 2009-02-26 22:14:37 UTC
Alsa bug report :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426

Comment 6 Catagne 2009-03-04 12:15:34 UTC
Since this may be due to pulseaudio also (sorry, but I really can't figure out if the problem originates in pulse audio or alsa), i also opened a pulseaudio ticked.

Pulse audio report :
http://pulseaudio.org/ticket/506

Comment 7 Lennart Poettering 2009-03-04 21:11:04 UTC
Hmm, tried on both x86-64 and i386 to reproduce this now with no luck.

Comment 8 Catagne 2009-03-05 00:12:56 UTC
Can reproduce the crash with the pulseaudio pulseaudio-0.9.14-1, Fedora 10 up to date, on 3 machines that differ in audio and processor/motherboard hardware.

Comment 9 Catagne 2009-03-05 11:05:05 UTC
After having upgraded again Fedora 10, the sample code  "Very simple sample code, with snd_pcm_open" does not crash anymore.

Conversely, the sample code "Sample program that causes the segfault", that uses portaudio, still crashes on my 3 Fedora10 machines.

Comment 10 Catagne 2009-03-05 13:09:48 UTC
Yet another note.

I've tried again to isolate the problem.

I think the problem comes from a call to snd_config_update_free_global().

I don't know whether :
- the call to snd_config_update_free_global() made by portaudio is wrong
- or the call to snd_config_update_free_global() made by portaudio is correct, but the problem originates in alsalib itself.

I upload new sample codes TestPaQt06.tar.gz

There you'll find :

1- a sample program that uses alsa that exhibits the problem. The code may be wrong since I am not used to alsa, but the problem is there.

2- a sample program that uses portaudio that exhibits the problem.


To compile the latest, just use the latest portaudio snapshot.

There is a "hack" for the portaudio program :
in portaudio,
file portaudio/src/hostapi/alsa/pa_linux_alsa.c
comment the call to snd_config_update_free_global()
Just comment this line to make the bug disapear.

Hope it helps.

Comment 11 Catagne 2009-03-05 13:10:40 UTC
Created attachment 334129 [details]
New sample program

1- a sample program that uses alsa that exhibits the problem. The code may be wrong since I am not used to alsa, but the problem is there.

2- a sample program that uses portaudio that exhibits the problem.

To compile the latest, just use the latest portaudio snapshot.

There is a "hack" for the portaudio program :
in portaudio,
file portaudio/src/hostapi/alsa/pa_linux_alsa.c
comment the call to snd_config_update_free_global()
Just comment this line to make the bug disapear.

Comment 12 Lennart Poettering 2009-03-19 11:13:52 UTC
*** Bug 490196 has been marked as a duplicate of this bug. ***

Comment 13 Matthias Saou 2009-04-13 12:46:33 UTC
Copying Hans, the new portaudio maintainer (thanks for volunteering!) :-)

Comment 14 Lennart Poettering 2009-07-31 14:12:02 UTC
The problem might be that snd_dlobj_cache_cleanup() is not thread-safe?

Comment 15 Jakub Jelinek 2009-08-03 09:27:40 UTC
A crash in __nptl_deallocate_tsd typically means using pthread_key_create with a destructor, but forgetting to pthread_key_delete it in library destructors and the library being dlclosed (so it is not mapped any longer).

Comment 16 Lennart Poettering 2009-09-07 22:36:46 UTC
This is fixed now. the PA libs are now marked NODELETE so this shouldn't happen anymore.


Note You need to log in before you can comment on or make changes to this bug.