jack-example-tools icon indicating copy to clipboard operation
jack-example-tools copied to clipboard

zalsa internal client crashes if alsa device has disappeared

Open riban-bw opened this issue 11 months ago • 5 comments

If you load zalsa_in or zalsa_out for a USB connected audio device then that device is removed, attempt to unload the zalsa client will crash jackd, presumably because zalsa crashes, dragging down jackd. Removal of the USB audio device is not detected by zalsa and hence the client remains in the jackd tree.

There should be a way to unload a client without crashing jackd.

riban-bw avatar Jan 09 '25 08:01 riban-bw

jack_unload gives following error when device is no longer available:

Cannot read socket fd = 7 err = No such file or directory
Could not read result type = 24

riban-bw avatar Jan 09 '25 08:01 riban-bw

Log from jackd -v -d dummy after jack_unload called.

Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 3
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 15
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 2 fd = 16
Jack: JackSocketServerChannel::Execute : poll client error err = No such file or directory
Jack: JackSocketServerChannel::ClientKill ref = -1 fd = 16
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 = 15
Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 3
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 15
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 2 fd = 16
Jack: JackRequest::ClientCheck
Jack: Check protocol client = 9 server = 9
Jack: JackRequest::ClientOpen
Jack: JackEngine::ClientExternalOpen: uuid = 4, name = jack_unload
Jack: JackEngine::AllocateRefNum ref = 2
Jack: JackLinuxFutex::Allocate name = jack_sem.0_default_jack_unload val = 0
Jack: JackSocketNotifyChannel::Open name = jack_unload
Jack: JackClientSocket::Connect : addr.sun_path /dev/shm/jack_jack_unload_0_0
Jack: JackShmMem::new index = 2 attached = 136fc000 size = 440 
Jack: JackExternalClient::Open name = jack_unload index = 2 base = 136fc000
Jack: JackPosixProcessSync::TimedWait time out = 5000000
Jack: JackPosixProcessSync::TimedWait finished delta = 1997.0
Jack: JackEngine::NotifyAddClient: name = jack_unload
Jack: JackDriver::ClientNotify ref = 2 driver = system name = jack_unload notify = 0
Jack: JackExternalClient::ClientNotify ref = 0 client = jack_unload name = system notify = 0
Jack: JackDriver::ClientNotify ref = 2 driver = freewheel name = jack_unload notify = 0
Jack: JackExternalClient::ClientNotify ref = 1 client = jack_unload name = freewheel notify = 0
Jack: JackClient::ClientNotify ref = 2 name = jack_unload notify = 0
Jack: JackClient::kAddClient fName = zalsa_in name = jack_unload
Jack: JackExternalClient::ClientNotify ref = 3 client = jack_unload name = zalsa_in notify = 0
Jack: JackSocketServerChannel::ClientAdd ref = 2 fd = 16
Jack: JackSocketServerChannel::BuildPoolTable size = 3
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 15
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 2 fd = 16
Jack: JackRequest::InternalClientHandle
Jack: InternalClientHandle found client name = zalsa_in ref = 3
Jack: JackRequest::InternalClientUnload
Jack: JackClient::Close ref = 3
Jack: JackClient::Deactivate
Jack: JackServer::IsRunning
Jack: JackEngine::ClientDeactivate ref = 3 name = zalsa_in
Jack: JackEngine::PortDisconnect ref = -1 src = 5 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 6 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 7 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 8 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 9 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 10 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 11 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 12 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 13 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 14 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 15 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 16 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 17 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 18 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 19 dst = 65535
Jack: JackEngine::PortDisconnect ref = -1 src = 20 dst = 65535
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackEngine::ClientNotify: no callback for notification = 10
Jack: JackConnectionManager::DirectDisconnect last: ref1 = 3 ref2 = 1
Jack: JackGraphManager::DisconnectRefNum cur_index = 6 ref1 = 3 ref2 = 1
Jack: JackConnectionManager::DirectDisconnect last: ref1 = 1 ref2 = 3
Jack: JackGraphManager::DisconnectRefNum cur_index = 6 ref1 = 1 ref2 = 3
Jack: JackPosixProcessSync::TimedWait time out = 426660
Jack: JackPosixProcessSync::TimedWait finished delta = 14511.0
Jack: JackClient::Deactivate res = 0
Jack: JackPosixThread::Kill
Jack: JackServer::IsRunning
Jack: JackEngine::ClientInternalClose ref = 3
Jack: JackEngine::ClientCloseAux ref = 3
Jack: JackEngine::PortUnRegister ref = 3 port_index = 5
Jack: JackEngine::PortDisconnect ref = -1 src = 5 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 5 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 5 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 6
Jack: JackEngine::PortDisconnect ref = -1 src = 6 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 6 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 6 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 7
Jack: JackEngine::PortDisconnect ref = -1 src = 7 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 7 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 7 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 8
Jack: JackEngine::PortDisconnect ref = -1 src = 8 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 8 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 8 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 9
Jack: JackEngine::PortDisconnect ref = -1 src = 9 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 9 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 9 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 10
Jack: JackEngine::PortDisconnect ref = -1 src = 10 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 10 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 10 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 11
Jack: JackEngine::PortDisconnect ref = -1 src = 11 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 11 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 11 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 12
Jack: JackEngine::PortDisconnect ref = -1 src = 12 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 12 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 12 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 13
Jack: JackEngine::PortDisconnect ref = -1 src = 13 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 13 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 13 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 14
Jack: JackEngine::PortDisconnect ref = -1 src = 14 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 14 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 14 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 15
Jack: JackEngine::PortDisconnect ref = -1 src = 15 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 15 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 15 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 16
Jack: JackEngine::PortDisconnect ref = -1 src = 16 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 16 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 16 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 17
Jack: JackEngine::PortDisconnect ref = -1 src = 17 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 17 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 17 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 18
Jack: JackEngine::PortDisconnect ref = -1 src = 18 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 18 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 18 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 19
Jack: JackEngine::PortDisconnect ref = -1 src = 19 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 19 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 19 
Jack: JackEngine::PortUnRegister ref = 3 port_index = 20
Jack: JackEngine::PortDisconnect ref = -1 src = 20 dst = 65535
Jack: JackGraphManager::DisconnectAllOutput port_index = 20 
Jack: JackConnectionManager::RemoveOutputPort ref = 3 port_index = 20 
Jack: JackGraphManager::RemoveAllPorts ref = 3
Jack: JackPosixProcessSync::TimedWait time out = 85332
Jack: JackPosixProcessSync::TimedWait finished delta = 17287.0
Jack: JackDriver::ClientNotify ref = 3 driver = system name = zalsa_in notify = 1
Jack: JackDriver::ClientNotify ref = 3 driver = freewheel name = zalsa_in notify = 1
Jack: JackExternalClient::ClientNotify ref = 3 client = jack_unload name = zalsa_in notify = 1
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
Jack: JackEngine::ClientNotify: no callback for notification = 4
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
Jack: JackEngine::ClientNotify: no callback for notification = 4
Jack: JackRequest::ClientClose
Jack: JackEngine::ClientExternalClose ref = 2
Jack: JackEngine::ClientCloseAux ref = 2
Jack: JackGraphManager::RemoveAllPorts ref = 2
Jack: JackPosixProcessSync::TimedWait time out = 85332
Jack: JackPosixProcessSync::TimedWait finished delta = 2470.0
Jack: JackDriver::ClientNotify ref = 2 driver = system name = jack_unload notify = 1
Jack: JackDriver::ClientNotify ref = 2 driver = freewheel name = jack_unload notify = 1
Jack: JackExternalClient::Close
Jack: JackSocketNotifyChannel::Close
Jack: JackClientSocket::Close
Jack: JackShmMem::delete size = 0 index = 2
Jack: JackSocketServerChannel::ClientRemove ref = 2 fd = 16
Jack: JackClientSocket::Close
Jack: JackSocketServerChannel::BuildPoolTable size = 2
Jack: JackSocketServerChannel::BuildPoolTable fSocketTable i = 1 fd = 15
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
Segmentation fault

riban-bw avatar Jan 10 '25 08:01 riban-bw

The log when the USB is not removed is identical except for pointer references, timings and the Segmentation fault. So it looks like the process completes and then seg faults.

riban-bw avatar Jan 10 '25 08:01 riban-bw

I experienced the same issue when using the zita-ajbridge tools intead of the zalsa plugins. In this case, only the process 'zita-a2j' or 'zita-j2a' crashes, without crashing the entire Jack server. Until there's a fix, this is one alternative you could use. I actually prefer using a separate process, seems more stable and less bug-prone.

farshield avatar Feb 01 '25 10:02 farshield

Indeed! This is the only viable solution. This ug report is specifically about internal clients killing the parent. I am having to use external clients because of the issue. The external client still crashes but that does not impact my usecase.

riban-bw avatar Feb 01 '25 12:02 riban-bw