app: Add respawn rate limiting to prevent CPU spinning#337
Open
vkareh wants to merge 1 commit into
Open
Conversation
When a non-client app with AutoRestart enabled exits immediately after starting, the restart logic would loop without delay, causing high CPU usage. This adds a 60-second rate limit to gsm_app_restart. If an app respawns twice within this window, the second restart is rejected. The code is adapted from: - https://gitlab.gnome.org/GNOME/gnome-session/-/commit/4df48234 - https://gitlab.gnome.org/GNOME/gnome-session/-/commit/b9aa675e Fixes #336
lukefromdc
reviewed
Jun 12, 2026
lukefromdc
left a comment
Member
There was a problem hiding this comment.
I cannot test run this at the moment as I am in the middle of a mate-wayland session, but the code itself looks good. If the crashing app has an existing restart time (has restarted before) within the rate limit time, gsm_app_restart returns FALSE
A build of this finished fine, didn't even see any warnings from mate-session-gsm-app.o
I don't have any non-MATE apps that use this that I know use it so not really up for a good functional test but this has sat for a while and the CPU sitting and spinning is something we need to fix
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.
When a non-client app with AutoRestart enabled exits immediately after starting, the restart logic would loop without delay, causing high CPU usage. This adds a 60-second rate limit to gsm_app_restart. If an app respawns twice within this window, the second restart is rejected.
The code is adapted from:
Fixes #336