Skip to content

fix(daemon): drain UI channel in headless mode to prevent panic#1063

Open
DevenDucommun wants to merge 1 commit into
EFForg:mainfrom
DevenDucommun:fix/diag-notification-panic
Open

fix(daemon): drain UI channel in headless mode to prevent panic#1063
DevenDucommun wants to merge 1 commit into
EFForg:mainfrom
DevenDucommun:fix/diag-notification-panic

Conversation

@DevenDucommun

@DevenDucommun DevenDucommun commented Jun 9, 2026

Copy link
Copy Markdown

The headless display (PinePhone) was dropping the UI update receiver immediately without consuming it. This caused sends from diag.rs to fail with SendError and panic. Fix: spawn a drain task in headless mode that consumes messages until shutdown, consistent with all other display implementations.

Affected location:

  • daemon/src/display/headless.rs

Fixes #657

Pull Request Checklist

  • The Rayhunter team has recently expressed interest in reviewing a PR for this.
    • If not, this PR may be closed due our limited resources and need to prioritize how we spend them.
  • Added or updated any documentation as needed to support the changes in this PR.
  • Code has been linted and run through cargo fmt.
  • If any new functionality has been added, unit tests were also added.
  • CONTRIBUTING.md has been read.
  • Your pull request is fewer than ~400 lines of code.

You must check one of:

  • No generative AI (including LLMs) tools were used to create this PR.
  • Generative AI was used to create this PR. I certify that I have read and understand the code, and that all comments and descriptions were authored by myself and are not the product of generative AI.

@DevenDucommun

Copy link
Copy Markdown
Author

Fixing panics when notification/UI channels close during shutdown. When the receiver drops (e.g. during graceful shutdown), the daemon panics with an .expect() backtrace instead of handling it cleanly. This replaces those with warn!() logging so it exits gracefully.

This contribution was developed with AI assistance. I have reviewed, understood, and tested the change.

@untitaker

Copy link
Copy Markdown
Collaborator

i think the fix is to not return in the pinephone UI code. this fix would just spam warnings when running on pinephone.

On PinePhone (headless display), the UI update receiver was dropped
immediately, causing sends from diag.rs to fail with SendError and
panic. Spawn a task that drains the channel until shutdown.

Fixes EFForg#657

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DevenDucommun DevenDucommun force-pushed the fix/diag-notification-panic branch from cf788bd to 479d0df Compare June 9, 2026 21:26
@DevenDucommun

Copy link
Copy Markdown
Author

You're right, updated the fix. The headless display was dropping the receiver immediately, so now it spawns a task to drain the channel until shutdown. Single file change, no more warn!() spam.

@DevenDucommun DevenDucommun changed the title fix(daemon): replace panicking expects with warnings on channel sends fix(daemon): drain UI channel in headless mode to prevent panic Jun 9, 2026
@untitaker

Copy link
Copy Markdown
Collaborator

I assume you didn't test it but this feels simple enough to merge as-is.

one note though: please don't let AI write comments for you

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.

Rayhunter panics when sending an analyzer notification on Pinephone

2 participants