Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart desktop process on systray errors #1835

Merged
merged 13 commits into from
Sep 3, 2024

Conversation

RebeccaMahany
Copy link
Contributor

@RebeccaMahany RebeccaMahany commented Aug 14, 2024

Closes #1717.

Explanation of underlying cause

If we fail to init the instance, initialized will never get set, which means isReady will always return false. That means any time we attempt to perform an action on the systray in the future, like setting an icon, we'll always get the "tray not ready" errors.

Evaluation of options for solving the issue

Fix location Has knowledge of systray errors? Has knowledge of sleep state? Fix mechanism
systray Yes No Call registerSystray()
desktop No No Shut down and restart the menu
runner Yes, via monitoring desktop logs Yes, via InModernStandby Restart desktop process, or ask it to restart the menu

It would be cleanest to have systray manage its own errors. However, we do not want to take any action while we're in modern standby, and systray doesn't currently have knowledge of the InModernStandby flag. I don't think it's worthwhile to build in access to the flag.

I don't think it's practical for the desktop process to handle fixing the issue instead. It doesn't have knowledge of InModernStandby and it doesn't have access to systray state: it can't see the systray logs, and systray doesn't return any errors when menu actions fail.

On the runner side, we already process desktop logs; we could monitor these for systray errors, and take action once we reach a threshold of "tray not ready" errors when not in modern standby. We could easily restart the entire desktop process, or we could build a new endpoint to ask the desktop process to shut down and restart the menu only.

Implementation

The third option (handling in the runner, rather than in systray or desktop) is the approach I've taken.

I've also chosen the bigger and simpler hammer of restarting the entire desktop process, rather than implementing the ability to restart only the menu portion of the process.

Testing

It's proving difficult to trigger this error condition, so I've feature-flagged these changes so that we can enable them only for internal test devices.

@RebeccaMahany RebeccaMahany marked this pull request as ready for review August 29, 2024 17:28
@RebeccaMahany RebeccaMahany added the bug-fixes Bug Fixes label Aug 29, 2024
Copy link
Contributor

@zackattack01 zackattack01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@RebeccaMahany RebeccaMahany added this pull request to the merge queue Sep 3, 2024
Merged via the queue into kolide:main with commit 7041121 Sep 3, 2024
29 checks passed
@RebeccaMahany RebeccaMahany deleted the becca/systray-errors branch September 3, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fixes Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make windows desktop process responsive to repeated systray errors
2 participants