Repository navigation
fix(logger): avoid u8 counter overflow in buffered logger (#728) - #799
Merged
ytakano merged 2 commits intoNov 17, 2026
Merged
Conversation
The buffered logger counted printed messages in a `u8` with `n += 1`, which panics on the 256th message in debug builds. The logger task then moved to the panicked scheduler and all console output stopped. - Use `wrapping_add` for the yield counter. - If the buffered logger task panics, fall back to the raw console via the new `awkernel_lib::logger::unset_buf_console()` so later output, including the panic report, stays visible. Closes tier4#728 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ytakano
marked this pull request as ready for review
November 16, 2026 08:26
atsushi421
reviewed
Nov 16, 2026
The panic handler queues the panic report into the buffered logger's channel before unwinding, and the receiver was dropped before the fallback guard ran, so the report and all queued messages were lost. - Move the guard into the logger body, after the receiver, and drain the queue to the console when it is dropped. - Switch to direct output by clearing BUFFERED_LOGGER under its lock instead of rewriting the unsynchronized `buf_console` pointer, and remove `awkernel_lib::logger::unset_buf_console()`. - Print the fallback notice as a static string, without allocating during unwinding. Co-Authored-By: Claude Fable 5.2 <[email protected]>
atsushi421
approved these changes
Nov 17, 2026
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.
Description
The buffered logger counted printed messages in a
u8withn += 1, which panics on the 256th message in debug builds. The logger task then moved to the panicked scheduler and all console output stopped.wrapping_addfor the yield counter.Related links
Closes #728
How was this PR tested?
scripts/ci.shpasses on my machine.Notes for reviewers