jackclient-python icon indicating copy to clipboard operation
jackclient-python copied to clipboard

fix port listing crash when a port is removed during the listing

Open Houston4444 opened this issue 1 month ago • 1 comments

Hi.

I meet this crash several times with the method Client.get_ports() :

    for port in self.client.get_ports():
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/jack.py", line 1598, in get_ports
    return self._port_list_from_pointers(names)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/jack.py", line 1773, in _port_list_from_pointers
    ports.append(self.get_port_by_name(_decode(name)))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/jack.py", line 1533, in get_port_by_name
    raise JackError('Port {0!r} not available'.format(name))
jack.JackError: Port 'Carla-Rack.rack:audio-in1' not available

The port name is not always the same. It happens when I switch from a (ray) session to another, many clients are quitting. It is very very probable that port has been destroyed during listing.

This patch fixes the problem with the choice to not raise any exception in this case, if port has gone, it must not be listed.

Houston4444 avatar Nov 17 '25 08:11 Houston4444