pw-jack: spurious 0-frame cycles
Version: 0.3.31
Description of Problem:
pw-jack sometimes returns spurious 0-size cycles to the application, which confuses and crashes Ardour (and presumably others; this isn't legal AIUI)
As far as I can tell, the code path that causes this is here. The comment above claims that the read() is blocking, but that does not seem to be the case (socket is probably actually in nonblocking mode?). Instead, when this works properly, it's the pw_data_loop_wait
here that ends up using epoll to wait for data, so the read() always returns data. The problem case seems to happen when pw_data_loop_wait
gets a different event on another fd (different epoll data), but cycle_wait
still goes ahead and calls cycle_run
and the read()
returns EAGAIN and that ends up trickling up as jack_cycle_wait
returning 0, which means a 0-sample process cycle to the calling application.
I'm guessing cycle_wait
should actually loop, calling pw_data_loop_wait
again until cycle_run
returns nonzero.
I can easily repro this on a debug Ardour build with assertions, by opening a new Ardour project, going to the mixer, and disconnecting one of the master outputs, though this may or may not have to do with other peculiarities of my setup.