Repository navigation
Conversation
Move the loop that runs the backplane until shutdown and then stops its boards from the daemon into Backplane::run(), which now takes the shutdown token. Make the event loop and shutdown_all_boards() private, since only run() calls them. This lets a test drive the backplane's shutdown without the daemon. It changes no behavior.
Add a test that starts a board on a backplane whose only transport has closed, as the CPU miner's does once it reports its board. The test expects the board to keep running until shutdown and to stop then. The backplane stops the board as soon as the transport closes, so mark the test should_panic until the fix lands. Refs: 256foundation#137
Wait for shutdown before stopping boards, even after every transport has closed. Since cd96476, each transport has its own channel to the backplane, and the backplane's event loop ends when the last one closes. The CPU miner's channel closes right after it reports its board, so with USB discovery disabled, as in the README Quick Start, the CPU board stopped milliseconds after it started. The backplane then forgot the board and never stopped it at shutdown. The CPU board has no shutdown work today, so nothing showed, but the shutdown hook in 256foundation#56 would run at startup. Fixes 256foundation#137.
Jolah1
force-pushed
the
fix-backplane-early-board-shutdown
branch
from
November 9, 2026 12:02
fda7036 to
8b202a7
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #137, reported in #122.
Since cd96476 the backplane stops every board as soon as its last transport closes, not only on shutdown. With
MUJINA_USB_DISABLE=1(the README Quick Start) the CPU transport is the only one, and it closes right after reporting its board, so the CPU board is stopped at startup and never at exit. This makes the backplane wait for shutdown before stopping boards.The first commit moves the run-until-shutdown loop from the daemon into
Backplane::run()with no change in behavior, so the backplane can be tested on its own. The second adds a regression test markedshould_panic, and the third fixes it.Tested with
just checkson each commit, and by running the daemon in Quick Start mode: on main the log showsBoard stoppedin the same second asBoard started, and with the fix only after Ctrl-C.