Skip to content

Fix Settings bug that occurs when not using JACK#8299

Merged
messmerd merged 2 commits intoLMMS:masterfrom
messmerd:fix-jack-server-start-when-opening-settings
Mar 18, 2026
Merged

Fix Settings bug that occurs when not using JACK#8299
messmerd merged 2 commits intoLMMS:masterfrom
messmerd:fix-jack-server-start-when-opening-settings

Conversation

@messmerd
Copy link
Copy Markdown
Member

@messmerd messmerd commented Mar 13, 2026

This fixes a regression from #7919.

Opening the Settings would unconditionally try to start the JACK server if it was not already running, even if the user was using an audio backend other than JACK. When it failed to start the JACK server, it would retry a few times which made opening the Settings take several seconds. For me, it also broke my whole system's audio, requiring me to restart pipewire (see the console logs below).

This PR fixes that problem by passing the JackNoStartServer option to jack_client_open() in the setupWidget used by the Settings. AudioJack::initJackClient() continues to use the JackNullOption option, so like before, it will still attempt to start the JACK server if you select the JACK backend and restart LMMS.

I also moved some static free functions into a nearby anonymous namespace, and I removed the server name argument from the jack_client_open() calls since that variadic argument is only supposed to be passed if the JackServerName option is passed (see documentation).


Console output showing the bug that was fixed by this PR

Click to expand
$ ./lmms 
*** WEAK-JACK: initializing
*** WEAK-JACK: OK. (0)
lilv_world_add_plugin(): warning: Duplicate plugin 
lilv_world_add_plugin(): warning: ... found in file:///home/dalton/.lv2/spectmorph.lv2/
lilv_world_add_plugin(): warning: ... and      file:///usr/local/lib/lv2/spectmorph.lv2/ (ignored)
Lv2 plugin SUMMARY: 18 of 40  loaded in 119 msecs.
For details about not loaded plugins, please set
  environment variable "LMMS_LV2_DEBUG" to nonempty.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.21
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2022 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
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel

ATTENTION: The playback device "hw:0" is already in use. The following applications are using your soundcard(s) so you should check them and stop them as necessary before trying to start JACK again:

pipewire (process ID 2501)

JackTemporaryException : now quits...
Released audio card Audio0
audio_reservation_finish
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
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 -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
jack_client_open() failed, Status: 0x11
Overall operation failed. JACK dependencies might need to be installed.
Could not connect to JACK server.

Opening the settings would unconditionally try to start the JACK server
if it was not already running, even if the user was using an audio
backend other than JACK. This fixed that problem by passing the
JackNoStartServer option to jack_client_open() in the setupWidget.
initJackClient() continues to use the JackNullOption option, so it will
still attempt to start the JACK server if you select the JACK backend
and restart LMMS.
Copy link
Copy Markdown
Contributor

@JohannesLorenz JohannesLorenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left 1 comment.

Review scope:

  1. Functional code review -> OK
  2. Style code review -> OK
  3. Testing -> OK

I tested:

  1. Jack Server not available on system -> Error message on stderr, settings dialog still opens normally
  2. Jack Client is available, but not started -> Jack is being started, dialog works
  3. Jack Client is already started -> No messages, dialog works

Comment thread src/core/audio/AudioJack.cpp Outdated
: AudioDeviceSetupWidget(AudioJack::name(), parent)
{
const char* serverName = nullptr;
// TODO: Add a button to start the JACK server?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the disadvantage of this PR is for users who have jack installed properly but don't have it started currently, these users can now not see the option dialogue. I assume that's exactly what this comment proposes. It would be a good solution to this.

I assume it's not much work to add such a button to start (and possibly also to stop) the jack server? I guess it would be a nice compensation to this PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing!

So, the disadvantage of this PR is for users who have jack installed properly but don't have it started currently, these users can now not see the option dialogue.

No, if JACK is the selected as the current audio device in the Settings, AudioJack::initJackClient() will be called at startup and start the JACK server if it isn't already. With this PR it just won't try to start the JACK server again when opening the Settings, since should already be started due to AudioJack::initJackClient().

The start/stop button would be useful in the future if we're able to change the audio device without restarting LMMS. We'd want there to be a way to display the JACK server status and provide a button to start the JACK server. Bitwig Studio has such a feature.

But for now having that button would be less useful. For example, if you're currently using the SDL backend but then go into the Settings and switch to JACK, the JACK server might not be running so you'd want to start it. However, even if you start it you wouldn't be able to use it until you restart LMMS, and LMMS already takes care of starting the JACK server at startup, so there wouldn't be much use to having the button right now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for now having that button would be less useful. For example, if you're currently using the SDL backend but then go into the Settings and switch to JACK, the JACK server might not be running so you'd want to start it.

Sorry, yes, that was what I meant.

Let's see what Copilot has to say 😆

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression where opening the Settings dialog would try to start the JACK server even when JACK isn’t the selected audio backend, causing multi-second delays and potentially disrupting system audio.

Changes:

  • Open the JACK client from the Settings/setup widget with JackNoStartServer to avoid auto-starting JACK.
  • Keep AudioJack::initJackClient() behavior unchanged (JackNullOption) so selecting the JACK backend still attempts to start the server as before.
  • Remove the unused JACK server-name vararg from jack_client_open() calls and refactor local statics into an anonymous namespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/audio/AudioJack.cpp Outdated
@messmerd messmerd merged commit 0f0d972 into LMMS:master Mar 18, 2026
11 checks passed
@messmerd messmerd deleted the fix-jack-server-start-when-opening-settings branch March 18, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants