Open RJVB opened 1 year ago
Thanks for the nice clean clear bug report.
stream->hostApi
shouldn't be NULL anywhere in a correctly initialized stream.
I suppose not, but with the stream of errors in the output leading up to the crash I don't want to point fingers who does what wrong where. Instead it seems clear that PortAudio catches a lot of abnormal situations before letting one slip that leads to a crash. I think the AddStream
error in pa_jack.c just above is probably enough indication that the stream didn't initialise correctly and so the callback shouldn't be activated (if you don't want to add a nullptr check inside the callback)?
Jack does work on the system where this report originated, btw. It just turns out to be a PITA to get to use it cleanly on a desktop system that really wants PulseAudio running too.
These errors are interesting:
These seem to be coming from PaAlsa_GetStreamOutputCard() but I cannot find any calls to that function. Audacity uses a modified version of PortAudio.
Expression 'stream->playback.pcm' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4696
The AddStream() seems to assume the callback is already running. It times out waiting for a mutex to be freed. But the abort in the callback may prevent that.
Expression 'err != ETIMEDOUT' failed in 'src/hostapi/jack/pa_jack.c', line: 1061
Expression 'result' failed in 'src/hostapi/jack/pa_jack.c', line: 1081
Expression 'AddStream( stream )' failed in 'src/hostapi/jack/pa_jack.c', line: 1366
On Sunday May 28 2023 11:48:30 Phil Burk wrote:
Audacity uses a modified version of PortAudio.
That's not required anymore, and from my CMake output for Audacity:
-- ========== Using system version of PortAudio ==========
-- Found PortAudio:
PortAudio_INCLUDE_DIR: /opt/local/include
PortAudio_LIBRARIES: /opt/local/lib/libportaudio.so
The AddStream() seems to assume the callback is already running. It times out waiting for a mutex to be freed. But the abort in the callback may prevent that.
Ah, so maybe the nullptr dereference isn't one, but the error is trying to use an already freed mutex? I assumed stream->hostApi had to be NULL because of the mutex address in
frame #0: 0x000015554be5b6a3 libpthread.so.0`__pthread_mutex_trylock(mutex=0x0000000000000120) at pthread_mutex_trylock.c:43
but I can't remember verifying that.
@RJVB Do you remember when this error occurs? Is it when you start playing something or when you stop playing (i.e. during stream shutdown?).
The reason I ask, is that I suspect that there is something broken with the way pa_jack.c waits for the stream to end (among other types of waiting) and it's possible this would cause the stream data structure to be invalidated while the callback was still running (i.e. if the wait ends before it is supposed to).
Related #879
Probable dup of #724
@RJVB Do you remember when this error occurs?
Sadly, no, not after all these months. But judging from the terminal output I'd say it's more likely to happen during the preparations when starting playback. I am quite certain that I didn't try to use Jack so I suppose there's no stream to wait to end for in pa_jack.c .
Describe the bug The
JackCallback()
function assumesstream->hostApi
always points to something, which apparently is not guaranteed to be true.To Reproduce I think there's something fishy with my Jack installation or the way I'm running the daemon so I cannot provide a guaranteed recipe to reproduce this issue, but here's a terminal transcript that I can currently reproduce consistently:
Expected behavior Preferably some kind of message that Jack cannot be used, esp. if a different host is available.
Actual behavior A SIGSEGV. See the transcript above.
Desktop (please complete the following information):