Skip to content

fix(backplane): stop boards only on shutdown - #138

Open
Jolah1 wants to merge 3 commits into
256foundation:mainfrom
Jolah1:fix-backplane-early-board-shutdown
Open

Jolah1 wants to merge 3 commits into
256foundation:mainfrom
Jolah1:fix-backplane-early-board-shutdown

Conversation

@Jolah1

@Jolah1 Jolah1 commented Nov 9, 2026 •

Copy link
Copy Markdown

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 marked should_panic, and the third fixes it.

Tested with just checks on each commit, and by running the daemon in Quick Start mode: on main the log shows Board stopped in the same second as Board started, and with the fix only after Ctrl-C.

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
Jolah1 force-pushed the fix-backplane-early-board-shutdown branch from fda7036 to 8b202a7 Compare November 9, 2026 12:02
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.

bug(backplane): boards stop at startup when all transports close

1 participant