Skip to content

app: Add respawn rate limiting to prevent CPU spinning#337

Open
vkareh wants to merge 1 commit into
masterfrom
fix-restart-cpu-spin
Open

app: Add respawn rate limiting to prevent CPU spinning#337
vkareh wants to merge 1 commit into
masterfrom
fix-restart-cpu-spin

Conversation

@vkareh

@vkareh vkareh commented Jun 1, 2026

Copy link
Copy Markdown
Member

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

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
@vkareh vkareh requested a review from a team June 1, 2026 13:12
@rox4d rox4d mentioned this pull request Jun 2, 2026
2 tasks

@lukefromdc lukefromdc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

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.

high cpu usage (recent regression)

2 participants