Joulescope does not shutdown clean on linux

Being a happy joulescope user for a few years I recently have noticed left over processes after closing the application. This sometimes messes with a new application instance started later on.

I’m on linux, an ubuntu 20.04, and have noticed this with both v0.9.3 and v0.9.7.

The joulescope installation is simply the content of the .tar.gz unpacked in a directory. Application launch is done by calling joulescope_launcher.

Then, when I close joulescope, either by clicking File->Exit or by clicking the X on the window itself, the window closes but two joulescope_launcher processes are left behind.

I looked but could not find more detailed installation instructions unless I go the build from source route.

1 Like

HI @mogul, and thanks for taking the time to report this issue. Installation should be as simple as extracting the .tar.gz file to the directory of your choice, as you did.

I tried to duplicate this on my Ubuntu 20.04 LTS machine:

mliberty@taurus:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

I then ran the Joulescope UI using:

~/bin/joulescope_0_9_7/joulescope_launcher

I checked the processes using:

mliberty@taurus:~$ ps -Al | grep joulescope
0 S  1000    2827    2358  0  80   0 -   679 do_wai pts/0    00:00:00 joulescope_laun
0 S  1000    2828    2827 64  80   0 - 592703 poll_s pts/0   00:00:07 joulescope_laun

Unfortunately, when I close the Joulescope UI, these two processes go away. I tried a few different things, like unplugging the instrument and creating recordings, but couldn’t get the processes to stay running after exit.

Perhaps something else is going on? Would you mind emailing the Joulescope logs from ~/.joulescope/log to support at joulescope dot com? I’ll take a look to see if something else is happening.

Another option is to try running directly from python. If somehow your machine has incompatible binary libraries from my Ubuntu 20.04 machine, this may have different behavior than the .tar.gz distribution.

Create a python virtual environment, activate it, install the Joulescope UI, and run the UI:

python3 -m venv ~/venv/joulescope
. ~/venv/joulescope/bin/activate
pip3 install -U joulescope_ui
python3 -m joulescope

To run the Joulescope UI in the future as a one-liner:

. ~/venv/joulescope/bin/activate && python3 -m joulescope

I tried, got some complains from pip about bdist_wheel not there. I ignored the noise and fired up joulsescope. it started fine but still it did not end the process when I exited the program. Just as before.

Then I tried this:

python3 -m venv ~/venv/joulescope
~/venv/joulescope/bin/pip install wheel
~/venv/joulescope/bin/pip install -U pip
~/venv/joulescope/bin/pip install -U joulescope_ui
~/venv/joulescope/bin/python3 -m joulescope

It ran clean but the same, a process that did not terminate when ending clicking Exit.

Now, inspired by your earlier post, I discovered the ~/.joulescope directory, and found ~/.joulescope/config/joulescope_config.json.

Aha! Lets move the whole ~/.joulescope out of the way and give it a try.

Bingo! There we have it. Joulescope is now launching clean and terminting clean as well.
Both the .tar.gz installed one and the pip installed one.

I still have the bad config file, I can mail it if you are curious, but it simply must have been corrupted somehow, not sure if it is worth wasting too much energy on.

Anyway, problem solved and I’m happy. Perhaps we have an item for your FAQ?

And now I can even reproduce the condition where joulescope_ui does not terminate correctly…

  1. remove ~/.joulescope
  2. start joulescope, either binary dist or the pip installed one
  3. select View → Oscilloscope
  4. enable View → Multimeter (the 5th line)

at this point you see both graphs and numbers

  1. drag out the multimeter to become a separate window
  2. click File → Exit

Windows closes but process stays

1 Like

Wow, thanks @mogul! I am able to duplicate this behavior. I have no idea why yet, but appears to be very repeatable, which is great. Out of curiosity, I also tested these same steps on Windows, and it also does not exit clearly.

I created Issue #129 which we will investigate for the next release. Thank you!

It looks like the threads still respond correctly to kill. So for linux, you can:

  1. Type CTRL-Z in the terminal where you ran joulescope_launcher
  2. Type jobs
  3. Look for the Joulescope UI process id.
  4. Type kill %{job_id}, such as kill %1

Alternatively:
killall -9 joulescope_launcher