Bug 482797 - Seg fault using pthread, snd_pcm_open, and "pulse" playback
Seg fault using pthread, snd_pcm_open, and "pulse" playback
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
10
i386 Linux
low Severity urgent
: ---
: ---
Assigned To: Jaroslav Kysela
Fedora Extras Quality Assurance
:
: 490196 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-28 04:07 EST by Catagne
Modified: 2009-09-07 18:36 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Fedora 10, up to date (all upgrade installed)
Story Points: ---
Clone Of: 477203
Environment:
Last Closed: 2009-09-07 18:36:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Catagne 2009-01-28 04:07:21 EST
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 04:07:56 EST
Created attachment 330215 [details]
gdb trace
Comment 2 Catagne 2009-02-26 06:43:53 EST
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 06:45:23 EST
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 13:05:49 EST
Could you please open a bug with upstream and post the upstream bug number here for monitoring.
Comment 5 Catagne 2009-02-26 17:14:37 EST
Alsa bug report :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426
Comment 6 Catagne 2009-03-04 07:15:34 EST
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 16:11:04 EST
Hmm, tried on both x86-64 and i386 to reproduce this now with no luck.
Comment 8 Catagne 2009-03-04 19:12:56 EST
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 06:05:05 EST
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 08:09:48 EST
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 08:10:40 EST
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 07:13:52 EDT
*** Bug 490196 has been marked as a duplicate of this bug. ***
Comment 13 Matthias Saou 2009-04-13 08:46:33 EDT
Copying Hans, the new portaudio maintainer (thanks for volunteering!) :-)
Comment 14 Lennart Poettering 2009-07-31 10:12:02 EDT
The problem might be that snd_dlobj_cache_cleanup() is not thread-safe?
Comment 15 Jakub Jelinek 2009-08-03 05:27:40 EDT
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 18:36:46 EDT
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.