jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.17k stars 371 forks source link

jack can't be started via dbus after disconnecting and reconnecting usb audio interface #722

Open mfs12 opened 3 years ago

mfs12 commented 3 years ago

Describe the bug

After disconnecting usb audio interface jack2 can't be restarted via dbus.

Environment

Steps To Reproduce

# connect usb audio interface
% jack_control start
# check status
% jack_control status
--- status
started
# disconnect usb audio interface
% jack_control stop
--- stop
# reconnect usb audio interface
% jack_control start
--- start
DBus exception: org.jackaudio.Error.Generic: Failed to open server

Expected vs. actual behavior

I would jackdbus expect to recover from such a situation and be able to restart jackd via dbus. At the moment jack control dbus interface stops working.

nedko commented 3 years ago

IIRC this is long lurking bug in libjackserver (not jackdbus itself) caused by not uninitializing properly on some situations. jackd closes the process on server stop and thus proper uninitialization does not matter except for purists, but as jackdbus reuses the process and assumes that this will work (as it did in jack1 variant of jackdbus), such missing uninitialization (or maybe device reinitialization?) is bound to fail, in case of bugs in jack server itself (libjackserver in jack2)

If I'm right, if you reactivate jackdbus via "jack_control exit" before you reconnect the device, the bug will not be reproducible.

OTOH, patch(es) for fixing this and related bugs are welcome

nedko commented 3 years ago

https://github.com/jackaudio/jack2/pull/348 is probably related