This repository was archived by the owner on Oct 28, 2026. It is now read-only.
Repository navigation
Roku displays close after multimer's keep-alive loop, not before - #248
Merged
Merged
Conversation
A timer-driven app's script body ends while the app is still running, and multimer keeps it alive from its own exit hook. RokuDisplay and RokuDisplayWrapper registered close() with atexit on their first frame, so close() ran before that loop and quit the channel while the app was still drawing. When the first frame came from a timer instead, the hook was registered during exit and never ran at all. close() now goes to multimer's stop hooks when multimer is keeping the program alive, and to atexit otherwise. show() also returns early while close() is running: a timer could run it inside close()'s blocking ECP request, relaunch the channel and leave _launched set, so the next frame server was never fetched. Fixes #245
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #245.
A timer-driven app like testris keeps running after its script body ends, kept alive from multimer's exit hook.
RokuDisplayandRokuDisplayWrapperregisteredclose()withatexiton their first frame, so it ran before that loop and quit the Companion channel while the app was still drawing. If the first frame came from a timer instead, the hook was registered during exit and never ran, so the channel was never closed.close()now goes to multimer's stop hooks when multimer is keeping the program alive, and toatexitotherwise.show()returns early whileclose()runs: a timer could run it insideclose()'s blocking ECP request, relaunch the channel and leave_launchedset, so the next frame server was never fetched.Checked:
tests/test_roku_close.pyis new. Both of its behaviour tests fail on the old code. The re-entrancy one fails withbind, launch, quit, launch, bind, the order the issue describes.-crun still closes at exit.tests/test_cast_backends.pystill passes.