Well, it turned out that my pulseaudio process was in a bad state.- Each exit reminds me of a bug I've been experiencing, where the process hangs stuck in what `strace` shows as:Mostly this dies when I kill it (-15); sometimes I have to `kill -9`; exactly twice I have seen:Code: Select all
$ strace -p5501 Process 5501 attached - interrupt to quit futex(0xb2f03bd8, FUTEX_WAIT, 5504, NULL
on killing it -- so it looks like some misinteraction with pulseaudio libraries.Code: Select all
Assertion 'pthread_mutex_destroy(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:83, function pa_mutex_free(). Aborting.
I can now reproduce a similar problem at will:
- With a system that uses pulseaudio for sound, e.g. Ubuntu
- Start rocksndiamonds, verify sound output
- Move to a different levelset
- Verify that you're running pulseaudio:
Code: Select all
$ ps -f -C pulseaudio | grep $USER filbo 15636 1 0 Jul11 ? 00:02:44 /usr/bin/pulseaudio --start --log-target=syslog
- Put pulseaudio on hold (*):
Code: Select all
$ killall -u $USER -STOP pulseaudio
- Now try to exit rocksndiamonds. It will hang until you either:
- Kill rocksndiamonds -OR-
- Wake pulseaudio up (*):
Code: Select all
$ killall -u $USER -CONT pulseaudio
(*) Pulseaudio can be configured for per-user or system-wide daemon. If per-user, those two steps are fine; if system-wide then you would have to do the -STOP -CONT steps as root.
(RnD of course does not try to use pulseaudio. I always have to look this stuff up / figure it out on the fly. In this case: RnD calls SDL; SDL decides to use its ALSA output module; ALSA libs are configured via /usr/share/alsa/alsa.conf and pulse.conf to use libasound_module_conf_pulse.so, which uses libpulse.so. Which talks to the user's or system's pulseaudio daemon.)
So I started looking at the startup / shutdown / audio thread code in RnD, and decided I better not mess with it without a lot more study...
I'd hope to see two things implemented (and if they're already supposed to be that way, debugged):
- make sure all game-specific state saving etc. is done before trying to shut down anything sound-, graphics- or input-related
- try to bracket shutdown of things that might hang with some sort of protection -- alarms or something -- and if they fail, don't let that stop the program from exiting