Repository navigation
fix(hub): ask Windows about toasts on a thread of their own (#398) - #409
Merged
Merged
Conversation
Before each notification, and for GET /hub/notify, the hub asked Windows' notification platform for devstack's setting, synchronously on a tokio worker (`deliver` evaluates `sink.status()` before it logs the notice). A call into that other process that does not return holds the worker, and with it the task in its LIFO slot: the accept loop can be that task, and the hub keeps its port and lock without answering, as in #398, whose last log line was a lane restart whose lane had notified before. The Windows sink now runs every WinRT call (the setting and each toast) on one thread of its own. `status()` answers the setting as asked last (again every minute and after each toast), or, while a call has waited 30 s, that Windows does not answer, told once to the hooks (`notify_failed`). At most 16 toasts wait; more are dropped meanwhile. Refs #398 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Refs #398. This removes the likeliest cause of the hang. There is still no dump to prove it; the watchdog from #402 will produce one if it happens again.
Why this one:
POST …/lanes/<lane>/restart(200). That lane had producedservice_failednotices earlier the same day.notify::follow_lanereads the lane's new events and callsCenter::deliveron a tokio worker.deliverevaluatesself.sink.status()(for theshownfield) before it writes itsnoticeline. On Windows that isToastNotificationManager::CreateToastNotifierWithId(..).Setting(), a synchronous call into the notification platform, which is another process.Listen, new connections are refused once the backlog is full, accepted connections sit inCloseWait, the process is idle, and nothing more is logged (thenoticeline never comes).GET /hub/notifyandPOST /hub/notify/testmade the same call on a worker.showalready usedspawn_blocking.Change (
crates/devstack-desktop/src/windows/notify.rs):toaststhread makes every WinRT call: the setting, and each toast (with thedevstack://registry check).status()no longer calls Windows. It answers the setting as asked last: at start, every minute, and after each toast.status()says Windows' notification platform does not answer. This is told once throughhooks.failed, so the log getsnotify_failedand the dashboard gets a notice.status()from a cache.Tests: two new unit tests with a fake platform whose
showblocks:showandstatusstill return at once, the sink reports itself stuck once, and the waiting toasts show in order after the call is released.status()is the setting asked last.cargo clippyandcargo fmtare clean.cargo test -p devstack-desktop -p devstack-hubpasses. Not run against a really hanging notification platform.Docs: CHANGELOG (Fixed). In
docs/dashboard-api.md,GET /hub/notify'sunavailablenow names the new reason, and the doc says the setting may be up to a minute old.No review card: which thread the toast sink uses is internal. No trust, concept, contract or term changes.
Decided on my own: 30 s until "stuck", a one-minute refresh, a queue of 16.
Not changed, seen on the way:
entry()indevstack-hub/src/lib.rsholds the stackswatchread guard whileregistry::list()reads files (itsor_else). It is not a deadlock on its own, but it is the kind of thing to keep short.🤖 Generated with Claude Code