Skip to content

Fix tight retry-storm in LoungeService reconnect loop - #29

Open
GhaziTrueAlpha wants to merge 1 commit into
yuliskov:masterfrom
GhaziTrueAlpha:fix/cast-wake-on-sleep
Open

Fix tight retry-storm in LoungeService reconnect loop#29
GhaziTrueAlpha wants to merge 1 commit into
yuliskov:masterfrom
GhaziTrueAlpha:fix/cast-wake-on-sleep

Conversation

@GhaziTrueAlpha

Copy link
Copy Markdown

The generic catch(Exception) branch in startListening() had no backoff delay, unlike the normal-path Thread.sleep(3000) after a clean disconnect. When startListeningInt() throws a persistent error (e.g. UnknownHostException right after the TV's WiFi wakes from sleep, before DNS is actually reachable again), the loop retried in a tight busy-loop every ~10ms, hammering CPU/DNS instead of giving the network a chance to recover, and preventing the cast session from ever successfully (re)binding.

Part of the SmartTube wake-on-cast-while-asleep fix; see WAKE_ON_CAST_FIX.md in the SmartTube repo for the full diagnosis.

The generic catch(Exception) branch in startListening() had no backoff
delay, unlike the normal-path Thread.sleep(3000) after a clean
disconnect. When startListeningInt() throws a persistent error (e.g.
UnknownHostException right after the TV's WiFi wakes from sleep, before
DNS is actually reachable again), the loop retried in a tight busy-loop
every ~10ms, hammering CPU/DNS instead of giving the network a chance to
recover, and preventing the cast session from ever successfully
(re)binding.

Part of the SmartTube wake-on-cast-while-asleep fix; see
WAKE_ON_CAST_FIX.md in the SmartTube repo for the full diagnosis.
@GhaziTrueAlpha

Copy link
Copy Markdown
Author

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant