jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.2k stars 373 forks source link

Segmentation fault on armhf when running jackd verbose #815

Open peter-vanpoucke opened 2 years ago

peter-vanpoucke commented 2 years ago

Describe the bug

When I run jackd verbose on Raspberry Pi 4B with Raspbian 11 (bullseye) (armhf), it always crashes with a Segmentation fault using whatever client (like mpv or a test python script). Tested this with 1.9.17 and 1.9.19.

Environment

Steps To Reproduce

jackd -v -R -d alsa -r 48000 -P hw:0 -o 2 -S
mpv -ao jack song.wav

Expected vs. actual behavior

Expected a verbose output, instead I get the following output: jackd verbose output 202111281849.log

peter-vanpoucke commented 2 years ago

Tested this with the 64 bit image on the same Raspberry Pi (Linux localhost 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux) and the issue didn't occur.

falkTX commented 2 years ago

Please build with --debug and attach a debugger backtrace. Thanks

peter-vanpoucke commented 2 years ago

I purged the jackd package then performed these:

aptitude install libasound2-dev
./waf configure --prefix /usr --debug --alsa
./waf --prefix /usr --debug --alsa
sudo ./waf install --prefix /usr --debug
gdb --args /usr/bin/jackd -v -R -d alsa -r 48000 -P hw:0 -o 2 -S

But when running jack_test I still get a segmentation fault. I scripted that last command: debug.20211211170130.log

Let me know if you're missing things or if need to do more...

falkTX commented 2 years ago

That is nice progress, thanks. We can see it crashes on strlen, but your log doesn't indicate where.

Inside gdb run the command bt after the crash. That will dump the execution context that lead to the crash. Paste the output of the bt command here, that should tell us exactly where it is crashing.

peter-vanpoucke commented 2 years ago

there you go:

Jack: JackRequest::ClientOpen

Thread 4 "jackd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xaf040440 (LWP 22699)]
strlen () at ../sysdeps/arm/armv6/strlen.S:26
26      ../sysdeps/arm/armv6/strlen.S: No such file or directory.
(gdb) bt
#0  strlen () at ../sysdeps/arm/armv6/strlen.S:26
#1  0xb6c14890 in __vfprintf_internal (s=0xaf03ea88, s@entry=0x0, format=format@entry=0xb6f7f6e0 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", ap=..., ap@entry=..., mode_flags=mode_flags@entry=3204443768)
    at vfprintf-internal.c:1688
#2  0xb6c2680c in __vsnprintf_internal (string=0xaf03ebbe "JackEngine::ClientExternalOpen: uuid = -1225263392, name = \346]@", maxlen=<optimized out>, format=0xb6f7f6e0 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", args=...,
    mode_flags=mode_flags@entry=0) at vsnprintf.c:114
#3  0xb6c26870 in ___vsnprintf (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=...) at vsnprintf.c:124
#4  0xb6f17668 in jack_format_and_log (level=1, prefix=0xb6f793d8 "Jack: ", fmt=0xb6f7f6e0 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", ap=...) at ../common/JackError.cpp:74
#5  0xb6f177a0 in jack_log (fmt=0xb6f7f6e0 "JackEngine::ClientExternalOpen: uuid = %d, name = %s") at ../common/JackError.cpp:113
#6  0xb6f44c28 in Jack::JackEngine::ClientExternalOpen (this=0x33b50, name=0xaf03eea0 "jack_test", pid=22768, uuid=8589934595, ref=0xaf03edf0, shared_engine=0xaf03f5cc, shared_client=0xaf03f5d0, shared_graph_manager=0xaf03f5d4)
    at ../common/JackEngine.cpp:628
#7  0xb6f71338 in Jack::JackLockedEngine::ClientExternalOpen (this=0x33b50, name=0xaf03eea0 "jack_test", pid=22768, uuid=0, ref=0xaf03edf0, shared_engine=0xaf03f5cc, shared_client=0xaf03f5d0, shared_graph_manager=0xaf03f5d4)
    at ../common/JackLockedEngine.h:123
#8  0xb6f70788 in Jack::JackSocketServerChannel::ClientAdd (this=0xb57a4024, socket_aux=0xaee00690, req=0xaf03ee88, res=0xaf03f5c4) at ../posix/JackSocketServerChannel.cpp:131
#9  0xb6f68d60 in Jack::JackRequestDecoder::HandleRequest (this=0x358c0, socket=0xaee00690, type_aux=23) at ../common/JackRequestDecoder.cpp:73
#10 0xb6f68c64 in Jack::JackRequestDecoder::HandleRequest (this=0x358c0, socket=0xaee00690, type_aux=22) at ../common/JackRequestDecoder.cpp:63
#11 0xb6f7100c in Jack::JackSocketServerChannel::Execute (this=0xb57a4024) at ../posix/JackSocketServerChannel.cpp:245
#12 0xb6f36208 in Jack::JackPosixThread::ThreadHandler (arg=0xb57a4138) at ../posix/JackPosixThread.cpp:63
#13 0xb6b96300 in start_thread (arg=0xaf040440) at pthread_create.c:477
#14 0xb6c9a208 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
sneakers-the-rat commented 2 years ago

+1 having the same issue also on raspi and just reproduced exactly this^

boots fine and accesses the soundcard correctly

jackdmp 1.9.20
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 75
self-connect-mode is "Don't restrict self connect requests"
Jack: JackPosixThread::StartImp : create non RT thread
[New Thread 0xaf154440 (LWP 2238)]
Jack: JackPosixThread::ThreadHandler : start
Jack: playback device hw:sndrpihifiberry
Jack: capture device hw:sndrpihifiberry
Jack: apparent rate = 44100
Jack: frames per period = 1024
Jack: JackDriver::Open capture_driver_name = hw:sndrpihifiberry
Jack: JackDriver::Open playback_driver_name = hw:sndrpihifiberry
Jack: Check protocol client = 9 server = 9
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackLinuxFutex::Allocate name = jack_sem.1000_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 1024
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
creating alsa driver ... hw:sndrpihifiberry|-|1024|3|44100|0|0|nomon|swmeter|soft-mode|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 3 periods
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 3 periods for playback
Jack: JackSocketServerChannel::Open
Jack: JackServerSocket::Bind : addr.sun_path /dev/shm/jack_default_1000_0
Jack: JackSocketServerChannel::BuildPoolTable size = 1
Jack: JackEngine::Open
Jack: JackClientSocket::Connect : addr.sun_path /dev/shm/jack_default_1000_0
Jack: JackEngine::ClientInternalOpen: name = freewheel
Jack: JackEngine::AllocateRefNum ref = 1
Jack: JackLinuxFutex::Allocate name = jack_sem.1000_default_freewheel val = 0
Jack: JackEngine::NotifyAddClient: name = freewheel
Jack: JackDriver::ClientNotify ref = 1 driver = system name = freewheel notify = 0
Jack: JackDriver::ClientNotify ref = 0 driver = freewheel name = system notify = 0
Jack: JackConnectionManager::DirectConnect first: ref1 = 1 ref2 = 1
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 1 ref2 = 1
Jack: JackDriver::SetupDriverSync driver sem in flush mode
Jack: JackGraphManager::SetBufferSize size = 1024
Jack: JackAlsaDriver::Attach fBufferSize 1024 fSampleRate 44100
Jack: JackEngine::PortRegister ref = 0 name = system:playback_1 type = 32 bit float mono audio flags = 21 buffer_size = 1024
Jack: JackGraphManager::AllocatePortAux port_index = 1 name = system:playback_1 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 1
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAlsaDriver::Attach fPlaybackPortList[i] 1 
Jack: JackEngine::PortRegister ref = 0 name = system:playback_2 type = 32 bit float mono audio flags = 21 buffer_size = 1024
Jack: JackGraphManager::AllocatePortAux port_index = 2 name = system:playback_2 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 2
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackEngine::ClientNotify: no callback for notification = 9
Jack: JackAlsaDriver::Attach fPlaybackPortList[i] 2 
Jack: Clock source : system clock via clock_gettime
Jack: JackServer::Start
Jack: JackThreadedDriver::Start
Jack: JackPosixThread::StartImp : create non RT thread
[New Thread 0xaf0a3440 (LWP 2239)]
Jack: JackPosixThread::ThreadHandler : start
Jack: JackThreadedDriver::Init real-time
Jack: JackPosixThread::AcquireRealTimeImp priority = 75
Jack: JackPosixThread::StartImp : create non RT thread
[New Thread 0xaf022440 (LWP 2240)]
Jack: JackPosixThread::ThreadHandler : start
Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 2
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 9
Jack: JackRequest::Notification
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackDriver::ClientNotify ref = 1 driver = freewheel name = freewheel notify = 18
Jack: JackEngine::ClientNotify: no callback for notification = 4
Jack: JackEngine::ClientNotify: no callback for notification = 4

then this after I try to connect a client

Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 3
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 9
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 2 fd = 10
Jack: JackSocketServerChannel::Execute : poll client error err = Success
Jack: JackSocketServerChannel::ClientKill ref = -1 fd = 10
Jack: Client was not opened : probably correspond to server_check
Jack: JackClientSocket::Close
Jack: JackSocketServerChannel::BuildPoolTable size = 2
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 9
Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 3
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 9
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 2 fd = 10
Jack: JackRequest::ClientCheck
Jack: Check protocol client = 9 server = 9
Jack: JackRequest::ClientOpen

Thread 4 "jackd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xaf022440 (LWP 2240)]
strlen () at ../sysdeps/arm/armv6/strlen.S:26
26  ../sysdeps/arm/armv6/strlen.S: No such file or directory.

and bt

#0  strlen () at ../sysdeps/arm/armv6/strlen.S:26
#1  0xb6c28890 in __vfprintf_internal (s=0xaf020a88, s@entry=0x0, format=format@entry=0xb6f936f4 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", ap=..., ap@entry=..., mode_flags=mode_flags@entry=3204444408)
    at vfprintf-internal.c:1688
#2  0xb6c3a80c in __vsnprintf_internal (string=0xaf020bbe "JackEngine::ClientExternalOpen: uuid = -1225181452, name = \346]@", maxlen=<optimized out>, format=0xb6f936f4 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", args=..., 
    mode_flags=mode_flags@entry=0) at vsnprintf.c:114
#3  0xb6c3a870 in ___vsnprintf (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=...) at vsnprintf.c:124
#4  0xb6f2b668 in jack_format_and_log (level=1, prefix=0xb6f8d3d8 "Jack: ", fmt=0xb6f936f4 "JackEngine::ClientExternalOpen: uuid = %d, name = %s", ap=...) at ../common/JackError.cpp:74
#5  0xb6f2b7a0 in jack_log (fmt=0xb6f936f4 "JackEngine::ClientExternalOpen: uuid = %d, name = %s") at ../common/JackError.cpp:113
#6  0xb6f58c28 in Jack::JackEngine::ClientExternalOpen (this=0x69d18, name=0xaf020ea0 "a", pid=2259, uuid=8589934595, ref=0xaf020df0, shared_engine=0xaf0215cc, shared_client=0xaf0215d0, shared_graph_manager=0xaf0215d4)
    at ../common/JackEngine.cpp:628
#7  0xb6f85338 in Jack::JackLockedEngine::ClientExternalOpen (this=0x69d18, name=0xaf020ea0 "a", pid=2259, uuid=0, ref=0xaf020df0, shared_engine=0xaf0215cc, shared_client=0xaf0215d0, shared_graph_manager=0xaf0215d4)
    at ../common/JackLockedEngine.h:123
#8  0xb6f84788 in Jack::JackSocketServerChannel::ClientAdd (this=0xb57b6024, socket_aux=0xaee00690, req=0xaf020e88, res=0xaf0215c4) at ../posix/JackSocketServerChannel.cpp:131
#9  0xb6f7cd60 in Jack::JackRequestDecoder::HandleRequest (this=0x6c848, socket=0xaee00690, type_aux=23) at ../common/JackRequestDecoder.cpp:73
#10 0xb6f7cc64 in Jack::JackRequestDecoder::HandleRequest (this=0x6c848, socket=0xaee00690, type_aux=22) at ../common/JackRequestDecoder.cpp:63
#11 0xb6f8500c in Jack::JackSocketServerChannel::Execute (this=0xb57b6024) at ../posix/JackSocketServerChannel.cpp:245
#12 0xb6f4a208 in Jack::JackPosixThread::ThreadHandler (arg=0xb57b6138) at ../posix/JackPosixThread.cpp:63
#13 0xb6baa300 in start_thread (arg=0xaf022440) at pthread_create.c:477
#14 0xb6cae208 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
sneakers-the-rat commented 2 years ago

Rolled back to "legacy" (buster) raspiOS and issue resolved.

kovacsandre commented 1 year ago

I having exactly the same issue on Olimex's Olinuxino Micro with Jack 1.9.19 (debian repo version) and 1.9.22 too.

Linux version 5.10.105-olimex (root@runner-cpbkaozn-project-1-concurrent-0) (arm-linux-gnueabihf-gcc (Debian 8.3.0-2) 8.3.0, GNU ld (GNU Binutils for Debian) 2.31.1) #085648 SMP Tue Jan 10 08:58:08 UTC 2023