JACK recovery

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

JACK recovery

Mac-50
Hi,

I'm doing some development work, so naturally (well, maybe it;s just me...) and occasionally I attempt to run my code before I've started JACK.

After that it can not be started until I reboot, typical error:

09:59:57.411 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock


My question is what SHOULD i be doing in my code to prevent this?

(Obviously, I can start JACK in my code if it's not running...but, I've not found any info on checking for JACK and starting it from python.


AND, how do, or can, I get JACK to start after this occurs without a reboot?


Regards,
Mac

_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Christopher Arndt
Am 03.02.2017 um 16:12 schrieb Mac:
> My question is what SHOULD i be doing in my code to prevent this?

It depends.

> (Obviously, I can start JACK in my code if it's not running...but, I've
> not found any info on checking for JACK and starting it from python.

> AND, how do, or can, I get JACK to start after this occurs without a reboot?

There are two common ways to start JACK:

a) Simply as a subprocess of your user session or a program using JACK.

b) By starting jack-dbus and then configuring and starting JACK via the
DBUS interface.

To make solution a) (supposedly) more convenient, if a program tries to
connect to JACK, it can specify to have the JACK process automatically
started. However this can lead to problems and confusion*, if JACK is
normally run via method b). Luckily there's an environment variable to
disable this behaviour: JACK_NO_START_SERVER. Because I use jack-dbus, I
have the line "export JACK_NO_START_SERVER=1" in my ~/.bashrc, so
programs using JACK never try to automatically start JACK.

So I prefer solution b) and I have written a small Python application,
which lets me control jack-dbus from a small toolbar applet:

https://github.com/SpotlightKid/jack-select

This application contains a Python module to communicate with jack-dbus
via (surprise!) DBUS called "jackcontrol.py".

You can use it like this:

import dbus

from jackselect.jackcontrol import JackCtlInterface, get_jack_controller

bus = dbus.SessionBus()
jackdbus = get_jack_controller(bus)
jackctl = JackCtlInterface(jackdbus)

if jackctl.is_started():
    print("JACK already running!")
else:
    jackctl.start_server()


HTH, Chris



* Just search the mailing list on this topic and you'll find endless
threads ;)


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (1012 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Christopher Arndt
Am 03.02.2017 um 16:37 schrieb Christopher Arndt:
> This application contains a Python module to communicate with jack-dbus
> via (surprise!) DBUS called "jackcontrol.py".

BTW, if you don't want the dependency on the "dbus" module in your
Python program, you could also call the "jack_control" program via the
subprocess module and parse the output. But I personnally find that
cumbersome and error-prone.


Chris


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (1012 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Mac-50
In reply to this post by Mac-50
Hi Chris,

Are you implying that your app will restart JACK when it is the condition I describe?

On another note:

I cloned the git repository. Confirmed the depends.

My results following the README:

sudo make PREFIX=/usr install
pandoc -f markdown -t rst README.md > README.rst
/bin/sh: 1: pandoc: not found
Makefile:10: recipe for target 'README.rst' failed
make: *** [README.rst] Error 127

Or:

sudo make install-user
python setup.py install --user
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import setuptools
ImportError: No module named setuptools
Makefile:24: recipe for target 'install-user' failed
make: *** [install-user] Error 1

Thanks!
Mac


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Christopher Arndt
Am 03.02.2017 um 17:47 schrieb Mac:
> Are you implying that your app will restart JACK when it is the
> condition I describe?

No. My app ist just an example of an app that uses Python to control
JACK via DBUS, something that your app could do too.

> On another note:
>
> I cloned the git repository. Confirmed the depends.

From the readme (bottom):

"If you want to install jack-select from a Git repository clone, you'll
also need the Python docutils to build the man page from the ReST
source. If you want to create the ReST version of the README from the
Markdown source, you'll also need pandoc (only neccessary when you want
to create a source distribution archive)."

> Or:
>
> sudo make install-user

That should be "make install-user" (like it says in the readme).

> python setup.py install --user
> Traceback (most recent call last):
>   File "setup.py", line 4, in <module>
>     import setuptools
> ImportError: No module named setuptools

Install python-setuptools (or a similar named package, if you're not on
a Debian-like system). This isn't mentioned in the readme, since
setuptools nowadays is the status-quo universal requirement for
installing Python build / packages from source. All modern Linux distros
install this by default, AFAIK.


Chris


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (1012 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Mac-50
In reply to this post by Mac-50
 Hi Chris,

I thought I'd checked for setup tools, but I guess not. After installing that it did more.

the sudo make install-user was just one attempt I made after the initial no sudo didn't work.

Not sure if it's an issue but in amongst the output from the make was this:

byte-compiling build/bdist.linux-x86_64/egg/jackselect/jackselect.py to jackselect.pyc
  File "build/bdist.linux-x86_64/egg/jackselect/jackselect.py", line 265
    def handle_jackctl_signal(self, *args, signal=None, **kw):
                                                ^
SyntaxError: invalid syntax


Also, I noted that, though I'm using nothing but 3.x python, the install sent stuff to:
/usr/lib/python2.7/dist-packages

The make output makes no mention of python3.

And I don't see anything for jackselect in either pythonXX/dist-packages

But, the example app you provided in this thread works if I put it in the .../jack-select/jackselect directory.

I know next to nothing about the install process...so this be may perfectly normal.

Also, it appears in a quick glance at jackselect.py that the paths are wored to places on your PC. Am I reading that right?

and
from .jackcontrol import ...
Does the .jackcontrol imply a relative directory?
(apologies for a programming question...I searched a bit but couldn't find any reference...probably my using the wrong search terms.)

Mac

On Fri, Feb 3, 2017 at 11:47 AM, Mac <[hidden email]> wrote:
Hi Chris,

Are you implying that your app will restart JACK when it is the condition I describe?

On another note:

I cloned the git repository. Confirmed the depends.

My results following the README:

sudo make PREFIX=/usr install
pandoc -f markdown -t rst README.md > README.rst
/bin/sh: 1: pandoc: not found
Makefile:10: recipe for target 'README.rst' failed
make: *** [README.rst] Error 127

Or:

sudo make install-user
python setup.py install --user
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import setuptools
ImportError: No module named setuptools
Makefile:24: recipe for target 'install-user' failed
make: *** [install-user] Error 1

Thanks!
Mac



_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: JACK recovery

Christopher Arndt
Am 03.02.2017 um 18:37 schrieb Mac:
> SyntaxError: invalid syntax
>
> Also, I noted that, though I'm using nothing but 3.x python, the install
> sent stuff to:
> /usr/lib/python2.7/dist-packages
>
> The make output makes no mention of python3.

Ah yes, the Makefile assumes that "python" is Python 3, which
unfortunately isn't true for most distros. I fixed that now, but you can
also already override the python binary used by the Makefile:

sudo make PYTHON=python3 install

> But, the example app you provided in this thread works

Good, that means you have all the run-time dependencies installed.
setuptools is just needed when you want to install jack-select via the
Makefile (which runs "python setup.py install" to install the jackselect
Python package).

> if I put it in
> the .../jack-select/jackselect directory.

Yes, because it uses "from jackselect.jackcontrol import ...", so the
"jackselect" Python package has to be either installed in the
system-wide Python module path or be available in the current working
directory where you start the script.

https://docs.python.org/3/tutorial/modules.html#the-module-search-path

> Also, it appears in a quick glance at jackselect.py that the paths are
> wored to places on your PC. Am I reading that right?

No.

> from .jackcontrol import ...
>
> Does the .jackcontrol imply a relative directory?

Yes, relative to the file that uses this form of importing. This only
works within Python packages, though. Thatswhy in my example I used
"from jackselect.jackcontrol import ..." (without the leading dot). See
here for an explanation:

https://docs.python.org/2.5/whatsnew/pep-328.html

But you could also just take the "jackcontrol.py" file, and put it next
to your application's main script and then just use "from jackcontrol
import ...".


Chris


_______________________________________________
Linux-audio-user mailing list
[hidden email]
http://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (1012 bytes) Download Attachment