No more jack ports available

Since my last system update a day ago or so (I’m on Arch), I’m starting to get errors with Ardour complaining that it cannot create new tracks because there are no more jack ports available (even though I have just a few tracks, less than 20).

2022-01-21T23:01:54 [ERROR]: No more JACK ports are available. You will need to stop Ardour and restart JACK with more ports if you need this many tracks.
2022-01-21T23:01:54 [ERROR]: could not create 1 new mixed track

I can actually create new tracks if I quit Ardour and reopen it when I want to create a new track, so the problem does not seem to be with jack at all. Moreover, I am not even using real jack—I am on pipewire which now (since a few days ago I believe) does not even need the jack-dropin package anymore.

I start pipewire as a systemd service at startup and, as far as I know, all the configuration options are set up in pipewire.conf, but I didn’t see any parameter referring to a max number of jack ports there. Am I even right in thinking this may be a pipewire issue? How could I find out?

Each track has at least 3 ports (1 in, 2out). Then there is the master-bus a couple of control ports, etc. Not to mention default hardware capture/playback ports etc… It adds up quickly.

Run jack_lsp | wc -l to count all ports.

With real jack the solution is to increase the max number of available ports:

jackd --port-max ...

If I remember correctly the default is 256. I don’t know about PipeWire though, best ask over at their support channel.

Alternatively you could use Ardour/ALSA (no JCK, no PipeWire) there is no port-limit there.
Also try with actual jackd (not pipewire). If the issue does not exist with JACK, it’s a pipewire bug.

I seem to have run into this pipewire issue or a variation thereof. Or perhaps not.
I know I get that error message in Ardour from time to time (" Failed to register port "Audio 1/audio_in 1", reason is unknown from here"), but my current problems refers to the number of available ports and not their registration.
I will keep investigating on the pipewire side and will report back if I get any result.

I am not sure if this has also increased in jackd1 but jackd2 has a default of 2048 (has had for years now). The jackd man page, it seems has not been updated.

jack_control ep
shows:
port-max: Maximum number of ports. (uint:notset:2048:2048)

So it seems to be a pipewire bug, as I was able to find a similar (although not identical) issue reported on the issue tracker. Discussion continuing there.
As a partial workaround, disconnecting Ardour from the jack back-end and reconnecting it seems to solve the issue for a while (that is, it allows the creation of new tracks without quitting and relaunching Ardour).

More info on the Ardour side:
I tried launching Ardour from console on a new session and creating a new (MIDI) track. The operation was successful, but a lot of errors popped up in the console:

re-registration of JACK port named ardour:General MIDI Synth/midi_out 1
Reading player:General MIDI Synth took 2 microseconds, final size = 0
ALSA lib pcm_dsnoop.c:601:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5690:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5690:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
re-registration of JACK port named ardour:General MIDI Synth/audio_out 1
re-registration of JACK port named ardour:General MIDI Synth/audio_out

I am not sure if this is normal or a symptom of some serious misconfiguration on my side, but I am leaning toward the latter option.

If it was indeed the same bug, it was recently fixed in Pipewire and it’s part of the 0.3.49 release.