You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mac-capture: CoreAudio reconnect retries full device init forever at 300 ms / 2 s with no backoff #1358
Part of #1273 (found by the #1285 capture-plugin audit). B, retries forever without backoff.
plugins/mac-capture/mac-audio.c.h:463-467: the CoreAudio reconnect thread retries a full coreaudio_init (device lookup and AudioUnit setup) at a fixed interval:
while (os_event_timedwait(ca->exit_event, ca->retry_time) ==ETIMEDOUT) {
if (coreaudio_init(ca))
break;
}
retry_time is 300 ms after a default-device change and 2000 ms after an unplug or a failed first init (set at ~500 and ~730).
Failure scenario: with the device gone for good (an unplugged interface, a removed aggregate device), the source retries for its whole life. On the 300 ms path that is about 3 full device inits per second, indefinitely. It runs on its own thread, so there is no spin and no UI stall, but it's the retry-forever pattern.
Fix:
Exponential backoff, for example starting at retry_time and doubling to a cap of about 10–30 s.
Reset on a CoreAudio device-list or default-device change notification, which is the moment a retry can actually succeed.
Log once when the backoff reaches its cap.
Test: with a fake coreaudio_init that always fails, the attempt count over about 20 s follows the backoff, and a device-change notification resets it.
Claiming. Plan: exponential backoff for the CoreAudio reconnect (start at today's retry_time, double to a ~30 s cap), reset when CoreAudio reports a device-list or default-device change, one log line when the cap is reached. The backoff schedule goes in a pure helper with a Tier 1 cmocka test (simulated time; always-failing init, reset on notification) that runs on Linux; the macOS wiring is compile-checked by PR CI's macOS lane.
Activity
zackees commentedon Oct 17, 2026
Claiming. Plan: exponential backoff for the CoreAudio reconnect (start at today's retry_time, double to a ~30 s cap), reset when CoreAudio reports a device-list or default-device change, one log line when the cap is reached. The backoff schedule goes in a pure helper with a Tier 1 cmocka test (simulated time; always-failing init, reset on notification) that runs on Linux; the macOS wiring is compile-checked by PR CI's macOS lane.
test(mac-capture): RED CoreAudio reconnect retry schedule is a fixed …
fix(mac-capture): CoreAudio reconnect backs off to 30 s instead of a …
docs(features): ledger CoreAudio reconnect backoff (#1358, #1370)
fix(mac-capture): reconnect listeners use a refcounted wake context, …
mac-capture: CoreAudio reconnect backs off instead of retrying every …
zackees commentedon Oct 23, 2026
Fixed by #1370 (merged). That PR used
Refs, so the issue stayed open, but its body lists no remaining work.