[armel] Pulseaudio crashes other program using sound: Assertion 'pthread_mutex_unlock(&m->mutex) == 0'

Bug #932096 reported by Andrej Zieger
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Whenever a program tries to use sound in anyway (and in some wierd other cases like using tab-completion in a terminal) the program just crashes with

Assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:106, function pa_mutex_unlock(). Aborting.
Aborted

Because it lets metacity crash whenever I use tab in a terminal, it renders my system useless.

I found solutions for meego her: https://bugs.meego.com/show_bug.cgi?id=13567

Easiest workaround was to disable PTHREAD priority inheritance feature that was
the root cause at least on Your case.

For example to configure.ac, Add

pulseaudio_cv_PTHREAD_PRIO_INHERIT=no

Before

AS_IF([test "$pulseaudio_cv_PTHREAD_PRIO_INHERIT" = "yes"], [
    AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])
  ])

I will to apply this fix and as soon as I get it working/compiled I'll report back.

It might very well be a problem for armel with more than one core (as suggested on the other site).

Expect:
Sound output (or at least a normal running program)

What happens instead:
Program crashes with
Assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:106, function pa_mutex_unlock(). Aborting.
Aborted

Steps to reproduce:
Open Settings/Sound/Output/Test and test one speaker

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: pulseaudio 1:1.1-0ubuntu7
Uname: Linux 2.6.36.4 armv7l
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.23.
ApportVersion: 1.91-0ubuntu1
Architecture: armel
Date: Tue Feb 14 15:36:33 2012
SourcePackage: pulseaudio
UpgradeStatus: Upgraded to precise on 2012-02-09 (4 days ago)

Revision history for this message
Andrej Zieger (conisant) wrote :
Revision history for this message
Daniel Letzeisen (dtl131) wrote :

Until you resolve the issue, you should turn off event sounds (because the Tab/auto-complete will play a sound when prompting you).

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pulseaudio (Ubuntu):
status: New → Confirmed
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I see this issue, but only on armel. Since the original bug reporter is also using armel, this may be an arch-specific bug. It currently blocks unity-2d from starting on my ASUS Transformer. I have auto-login, so it ends up looping in a tight X session crash.

Changed in pulseaudio (Ubuntu):
importance: Undecided → Critical
milestone: none → ubuntu-12.04-beta-1
summary: - Pulseaudio crashes other program using sound: Assertion
+ [armel] Pulseaudio crashes other program using sound: Assertion
'pthread_mutex_unlock(&m->mutex) == 0'
Revision history for this message
David Henningsson (diwic) wrote :

It looks like a bug in the lower layers to me, but I'm okay with disabling priority inheritance for armel as a workaround. But please confirm that this actually resolves your problem.

Lowering severity as it does not seem to affect many machines? A transformer and something running kernel 2.6.36...?

Changed in pulseaudio (Ubuntu):
importance: Critical → Medium
status: Confirmed → Incomplete
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I checked out the latest packaging branch for pulseaudio using debcheckout, built, installed, and retested. Something in there fixes things. I'm looking forward to version 1:1.1-0ubuntu11 being released :).

Changed in pulseaudio (Ubuntu):
status: Incomplete → Fix Released
status: Fix Released → Incomplete
status: Incomplete → Fix Committed
milestone: ubuntu-12.04-beta-1 → ubuntu-12.04-beta-2
Revision history for this message
Chase Douglas (chasedouglas) wrote :

Hmm, seems that I just had a moment of respite. I'm now seeing the crashes again...

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Triaged
Revision history for this message
Daniel T Chen (crimsun) wrote :

Just a note that my core i7 machine sees a *ton* of pthread_mutex*() crashes on precise that I cannot reproduce on oneiric. Because I'm seeing this in Rhythmbox, cinnamon, colord, etc., I don't think this is a pulseaudio-specific issue.

Martin Pitt (pitti)
Changed in pulseaudio (Ubuntu):
milestone: ubuntu-12.04-beta-2 → ubuntu-12.04
Revision history for this message
Andrej Zieger (conisant) wrote :

Sorry that I didn't wrote. I was in hospital for over a month with my son.
I can't confirm if it resolves the issue, because a recent update lets my system just flicker at the login screen...
So I have to figure out a much bigger problem first.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Andrej,

Unless you have autologin enabled, the unity greeter plays a sound theme file. This triggers the pulseaudio bug and crashes the greeter. Thus, an endless loop. You can work around this by adding an autologin user to /etc/lightdm/lightdm.conf.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

I think this may be a bug in eglibc's pthread implementation. In the following gdb output, I hit a breakpoint on pa_cond_wait(), which is a small wrapper around pthread_cond_wait(). Then I make a breakpoint on the following instructure in the next stack frame up. In theory, when pa_cond_wait() returns the thread should own the lock on the mutex (the __owner field is the LWP thread id) associated with the wait condition. However, it is owned by the other pulseaudio thread.

Breakpoint 2, pa_cond_wait (c=0x1b0eb8, m=0x1b0e98) at pulsecore/mutex-posix.c:134
134 pa_assert(c);
(gdb) l
129 else
130 pa_assert_se(pthread_cond_signal(&c->cond) == 0);
131 }
132
133 int pa_cond_wait(pa_cond *c, pa_mutex *m) {
134 pa_assert(c);
135 pa_assert(m);
136
137 return pthread_cond_wait(&c->cond, &m->mutex);
138 }
(gdb) up
#1 0x410cc530 in pa_threaded_mainloop_wait (m=0x11c8f8) at pulse/thread-mainloop.c:206
206 pa_cond_wait(m->cond, m->mutex);
(gdb) l
201 /* Make sure that this function is not called from the helper thread */
202 pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
203
204 m->n_waiting ++;
205
206 pa_cond_wait(m->cond, m->mutex);
207
208 pa_assert(m->n_waiting > 0);
209 m->n_waiting --;
210 }
(gdb) b 208
Breakpoint 3 at 0x410cc530: file pulse/thread-mainloop.c, line 208.
(gdb) c
Continuing.

Breakpoint 3, pa_threaded_mainloop_wait (m=0x11c8f8) at pulse/thread-mainloop.c:208
208 pa_assert(m->n_waiting > 0);
(gdb) p *m->mutex
$3 = {mutex = {__data = {__lock = 10454, __count = 1, __owner = 10462, __kind = 33, __nusers = 2, {__spins = 0, __list = {__next = 0x0}}},
    __size = "\326(\000\000\001\000\000\000\336(\000\000!\000\000\000\002\000\000\000\000\000\000", __align = 10454}}
(gdb) info thread
  Id Target Id Frame
  2 Thread 0x463ce2c0 (LWP 10462) "threaded-ml" pa_cond_signal (c=0x1b0eb8, broadcast=1) at pulsecore/mutex-posix.c:125
* 1 Thread 0x40163000 (LWP 10454) "metacity" pa_threaded_mainloop_wait (m=0x11c8f8) at pulse/thread-mainloop.c:208

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu.
Ubuntu 12.04 (precise) reached end-of-life on April 28, 2017.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

We appreciate that this bug may be old and you might not be interested in discussing it any more. But if you are then please upgrade to the latest Ubuntu version and re-test.

Changed in pulseaudio (Ubuntu):
milestone: ubuntu-12.04 → none
status: Triaged → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for pulseaudio (Ubuntu) because there has been no activity for 60 days.]

Changed in pulseaudio (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.