Bug 101497 - PulseAudio 10 crashes immediately when needed (dummy output): Assertion 'pthread_mutex_unlock(&m->mutex) == 0
Summary: PulseAudio 10 crashes immediately when needed (dummy output): Assertion 'pthr...
Status: RESOLVED NOTOURBUG
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: PowerPC Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-19 14:04 UTC by erhard_f
Modified: 2017-08-01 10:09 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
PulseAudio logfile (26.16 KB, text/x-log)
2017-06-19 14:04 UTC, erhard_f
Details
coredump of mpv concerning pulseaudio (2.68 KB, text/plain)
2017-06-19 14:05 UTC, erhard_f
Details
0001-mutex-posix-log-unlock-failure-reason.patch (1.41 KB, patch)
2017-06-20 13:27 UTC, Tanu Kaskinen
Details | Splinter Review
PulseAudio logfile after applying 0001 patch (174.16 KB, text/plain)
2017-06-24 06:41 UTC, erhard_f
Details
PulseAudio logfile after applying 0001 patch (dummy output) (17.51 KB, text/x-log)
2017-06-24 07:11 UTC, erhard_f
Details
132211: PulseAudio logfile after applying 0001 patch (dummy output) (141.24 KB, text/plain)
2017-06-24 07:27 UTC, erhard_f
Details
mpv verbose output (13.98 KB, text/plain)
2017-07-17 12:12 UTC, erhard_f
Details

Description erhard_f 2017-06-19 14:04:54 UTC
Created attachment 132059 [details]
PulseAudio logfile

Don't know if this is platform specific, but maybe not. System is a PowerMac G5, I am running MATE 1.18. There is no sound card configured as there is no working device driver. Pulseaudio is configured for 'dummy output'.

Anytime when I start an application which relies on PulseAudio it crashes immediately. No sound output is of course ok, if I configured dummy output, but if I can't use an application at all due to a crashing PulseAudion this is not so good...

Goes like that:
mpv /media/somevideo.mkv 
Playing: /media/somevideo.mkv
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) 'Stereo' (ac3)
     Audio --aid=2 --alang=ger 'Stereo' (ac3)
     Subs  --sid=1 --slang=ger (dvd_subtitle)
     Subs  --sid=2 --slang=eng (dvd_subtitle)
File tags:
 Title: DVD_VIDEO
Assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at /var/tmp/portage/media-sound/pulseaudio-10.0/work/pulseaudio-10.0/src/pulsecore/mutex-posix.c:108, function pa_mutex_unlock(). Aborting.
Abgebrochen (Speicherabzug geschrieben)

Sound modules loaded:
$ lsmod | grep -i snd
snd_aoa_i2sbus         23044  0
snd_pcm                98700  1 snd_aoa_i2sbus
snd_aoa_soundbus        4612  1 snd_aoa_i2sbus
snd_timer              28360  1 snd_pcm
snd_aoa                16888  0
snd                    63656  4 snd_aoa_i2sbus,snd_timer,snd_pcm,snd_aoa
soundcore               1544  1 snd

No ALSA-card configured, PulseAudeo set to dummy output, rest is default config.
Comment 1 erhard_f 2017-06-19 14:05:54 UTC
Created attachment 132060 [details]
coredump of mpv concerning pulseaudio
Comment 2 Tanu Kaskinen 2017-06-20 13:25:41 UTC
(In reply to erhard_f from comment #0)
> Anytime when I start an application which relies on PulseAudio it crashes
> immediately.

Is this specific to mpv, or are multiple applications crashing in the same way? The crash could be due to mpv calling pa_threaded_mainloop_unlock() when the thread doesn't hold the mainloop lock.

Another reason could be that mpv is linked to libpthread-stubs instead of the normal libpthread implementation. libpthread-stubs has been the reason for mutex failures in several occasions. What does this command print:

    ldd `which mpv` | grep pthread

I'll attach a patch that should make the crash log a bit more informative. Can you try it out?
Comment 3 Tanu Kaskinen 2017-06-20 13:27:03 UTC
Created attachment 132086 [details] [review]
0001-mutex-posix-log-unlock-failure-reason.patch
Comment 4 erhard_f 2017-06-20 14:58:15 UTC
This is not specific to mpv, multiple applications are crashing this way, e.g. Extreme Tux Racer. When etr is compiled without alsa/pulse it just starts normally.

$ ldd `which mpv` | grep pthread
	libpthread.so.0 => /lib/libpthread.so.0 (0x0e45b000)

I will try to apply your patch an report back in the next few days. Thanks!
Comment 5 erhard_f 2017-06-24 06:41:23 UTC
Created attachment 132210 [details]
PulseAudio logfile after applying 0001 patch
Comment 6 erhard_f 2017-06-24 06:41:43 UTC
Ok, back on track. Sorry it took me that long.
Comment 7 erhard_f 2017-06-24 07:10:47 UTC
Oops, just realized the logfile I uploaded was generated while the nonworking "snd-aoa-codec-onyx" driver was in use.

I'll upload a new logfile with PulseAudion dummy output/no card again.
Comment 8 erhard_f 2017-06-24 07:11:59 UTC
Created attachment 132211 [details]
PulseAudio logfile after applying 0001 patch (dummy output)
Comment 9 erhard_f 2017-06-24 07:27:12 UTC
Created attachment 132212 [details]
132211: PulseAudio logfile after applying 0001 patch (dummy output)
Comment 10 Tanu Kaskinen 2017-06-27 13:30:09 UTC
Can you attach the output from mpv? The log message that my patch adds won't be visible in the server log, it will be shown just before the assertion error in the client output.
Comment 11 Tanu Kaskinen 2017-06-27 13:31:45 UTC
Also, use "LANG=C mpv /media/somevideo.mkv" when starting mpv so that the error message will be in English.
Comment 12 erhard_f 2017-07-17 12:12:59 UTC
Created attachment 132733 [details]
mpv verbose output
Comment 13 erhard_f 2017-07-17 12:13:54 UTC
Sorry for the delay. Attatched please find mpv's verbose output.
Comment 14 Tanu Kaskinen 2017-07-24 21:39:58 UTC
Sorry for the delay on my part also.

So the error was "Operation not permitted". That means that a thread tried to unlock a mutex that it hadn't locked previously.

Are you familiar with getting backtraces with gdb? mpv's pulse output is working fine for me, and finding the exact code that fails requires a backtrace. There are some instructions here (but instead of running pulseaudio inside gdb, you need to run mpv inside gdb):
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Community/
Comment 15 erhard_f 2017-08-01 10:09:52 UTC
In the meantime I rebuilt the whole system based on gcc 6.3, binutils 2.28, glibc 2.24. Interestingly enough I can't reproduce the bug any longer, pulseaudio happily works as expected on my G5!

Sorry for the noise!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.