Bug 477203 - JVM crashes on exit when the PulseAudio daemon fails to start through alsa-plugins-pulse
Summary: JVM crashes on exit when the PulseAudio daemon fails to start through alsa-pl...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: pulseaudio
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-19 16:53 UTC by Omair Majid
Modified: 2009-08-10 20:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 482797 (view as bug list)
Environment:
Last Closed: 2009-08-10 20:44:41 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
test program (578 bytes, text/x-java)
2008-12-19 16:55 UTC, Omair Majid
no flags Details
backtrace (6.86 KB, application/octet-stream)
2008-12-19 16:56 UTC, Omair Majid
no flags Details

Description Omair Majid 2008-12-19 16:53:44 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008111217 Fedora/3.0.4-1.fc10 Firefox/3.0.4

If connection to a PulseAudio daemon fails, then the the Java runtime throws an exception, which is expected. But then the Java runtime crashes on exit. This happens only when using the ALSA api which redirects to PulseAudio. It doesnt happen when using the PulseAudio api directly. It seems to be very similar to 460666: segfault/corrpution in pthread_create.c

Reproducible: Always

Steps to Reproduce:
1. chmod 000 ~/.pulse/* so that the pulseaudio daemon fails to start (kill any instances running)
2. compile and run the attached program
 a. javac Mixers.java
 b. java Mixers
3. press enter to end the program
Actual Results:  
JVM crashes

Expected Results:  
JVM shuts down noramlly

Relevant Packages:
pulseaudio-0.9.13-6.fc10.i386
alsa-plugins-pulseaudio-1.0.18-1.rc3.fc10.i386
alsa-lib-1.0.18-6.rc3.fc10.i386
java-1.6.0-openjdk-1.6.0.0-7.b12.fc10.i386

Comment 1 Omair Majid 2008-12-19 16:55:01 UTC
Created attachment 327461 [details]
test program

Comment 2 Omair Majid 2008-12-19 16:56:22 UTC
Created attachment 327462 [details]
backtrace

Comment 3 Eric Moret 2008-12-19 22:21:07 UTC
Shouldn´t this be opened against the jvm?

Comment 4 Omair Majid 2008-12-22 16:00:14 UTC
Hi Eric. I am an IcedTea developer and I came across this bug when playing around with pulseaudio. I could be totally wrong about this being an alsa-plugins (or pulseaudio) bug, but I dont think that the JVM was the cause of the problem. Here is my reasoning: 

1) The JVM crashes on exit, not when it's using the alsa api.
2) The error appears to be in pthread_create.c (in libpthread.so) and native threads are not directly used by java when it interacts with alsa. Any problem with Java Threads would not cause the JVM to crash with stack corruption.
3) the gdb backtrace shows the problem to be
#13 <signal handler called>
#14 0x082ca300 in ?? ()
#15 0x007cc5ca in __nptl_deallocate_tsd () at pthread_create.c:154
#16 start_thread (arg=0x161b90) at pthread_create.c:304
which indicates that there is some problem with Thread Specific Data. PulseAudio has had problems like this before but they were fixed: http://www.redhat.com/archives/fedora-extras-commits/2008-November/msg00096.html. 

Also, this crash only happens when spawning the pulseaudio daemon fails. If pulseaudio is already running or is spawned successfully, then there are no crashes.

Anyway, I am not sure at all what the problem is, or what I can do to fix it. Any help will be appreciated. If you still think this is opened against the wrong package, let me know.

Comment 5 Eric Moret 2008-12-22 23:55:44 UTC
Thank you for your analysis, I am reassigning this one to Lennard, from the upstream project.

Comment 6 Catagne 2009-01-30 08:26:55 UTC
This may be related to https://bugzilla.redhat.com/show_bug.cgi?id=482797

Comment 7 Catagne 2009-02-26 12:57:39 UTC
Defintely a duplicate of 
https://bugzilla.redhat.com/show_bug.cgi?id=482797

See there for simple test code.

Comment 8 Lennart Poettering 2009-03-04 21:03:55 UTC
Hmm, I cannot reproduce this here.

Does this still happen with 0.9.14?

Comment 9 Lennart Poettering 2009-03-04 21:10:23 UTC
Hmm, tried on both x86-64 and i386 now with no luck.

Comment 10 Omair Majid 2009-03-04 21:21:21 UTC
I can reproduce this on i386 with pulseaudio-0.9.14-1.fc10.i386 :(

Comment 11 Catagne 2009-03-05 00:10:37 UTC
Can reproduce the bug with the same version of pulseaudio, Fedora 10 up to date, on my 3 machines that all differ in audio and processor/motherboard hardware.

Comment 12 Catagne 2009-03-05 00:11:34 UTC
Oups sorry, the latest comment was for  Bug 482797...

Comment 13 Lennart Poettering 2009-07-31 14:15:01 UTC
Does JVM call snd_config_update_free_global or snd_dlobj_cache_cleanup()?

Comment 14 Lennart Poettering 2009-08-10 20:44:41 UTC
OK, I think I know what's going on here: libpulse.so installs a TLS destructor but then gets unloaded so that the destructor function is called without existing in memory anymore, thus triggering a segfault.

This has been fixed in PA 0.9.16 now, we link everything with -z nodelete.


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