jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.19k stars 374 forks source link

jack_client_close makes jackd session unstable on macOS 12.3.1 #869

Open steffendasenbrock opened 2 years ago

steffendasenbrock commented 2 years ago

I observed a similar bug as already reported here.

Environment

Steps To Reproduce

I followed the instructions mentioned here here

Expected vs. actual behavior

On macOS 12.3.1 I get:

% ./test_jack_client_close
0.037297 jack_client_open succeeded
0.037317 jack_set_process_callback(jc1,...) returned 0
0.047708 jack_activate(jc1) returned 0
1.074949 jack_client_open succeeded
1.074968 jack_set_process_callback(jc2,...) returned 0
1.094260 jack_activate(jc2) returned 0
2.098897 port type is "32 bit float mono audio"
JackMachSemaphore::TimedWait name = js502.cli1 usec = 9223372036854775807 err = (os/kern) aborted
SuspendRefNum error
JackClient::Execute error name = cli1
3.118966 jack_deactivate(jc1) returned 0
3.118980 jc1_process was called 143 times
3.118984 jc2_process was called 95 times
4.143361 jack_client_close(jc1) returned 0
5.147283 port type jc2 is "32 bit float mono audio"
JackMachSemaphore::TimedWait name = js502.cli2 usec = 9223372036854775807 err = (os/kern) aborted
SuspendRefNum error
JackClient::Execute error name = cli2
6.169666 jack_deactivate(jc2) returned 0
6.169711 jc1_process was called 143 times
6.169716 jc2_process was called 237 times
7.208441 jack_client_close(jc2) returned 0
8.252999 jack_client_open succeeded
9.258067 port type is "32 bit float mono audio"
10.279375 jack_client_close returned 0
10.279397 jc1_process was called 143 times
10.279399 jc2_process was called 237 times

Expected output (Ubuntu 20.04.2, jack version: 1.9.12)

./test_jack_client_close
0.039246 jack_client_open succeeded
0.039310 jack_set_process_callback(jc1,...) returned 0
0.044882 jack_activate(jc1) returned 0
1.069785 jack_client_open succeeded
1.069831 jack_set_process_callback(jc2,...) returned 0
1.090306 jack_activate(jc2) returned 0
2.090449 port type is "32 bit float mono audio"
3.093255 jack_deactivate(jc1) returned 0
3.093298 jc1_process was called 142 times
3.093307 jc2_process was called 94 times
4.095875 jack_client_close(jc1) returned 0
5.096071 port type jc2 is "32 bit float mono audio"
6.101026 jack_deactivate(jc2) returned 0
6.101066 jc1_process was called 142 times
6.101073 jc2_process was called 234 times
7.124339 jack_client_close(jc2) returned 0
8.160049 jack_client_open succeeded
9.160279 port type is "32 bit float mono audio"
10.199585 jack_client_close returned 0
10.199620 jc1_process was called 142 times
10.199627 jc2_process was called 234 times
falkTX commented 2 years ago

err did apple break things again!? this was working fine in 12.1

will check it out by the time of the new release (plan is one every 3 months). anyone is welcome to try and amend the situation in the mean time.

thanks for the heads up

falkTX commented 1 year ago

Fixed in 79ea0746fa389df838d5db70506cb6799b432078 Not sure if there are side effects, I think the logic is correct (killing a thread can make any waiting semaphores to abort) Needs testing