Skip to content

cosmic-comp enters unthrottled render loop after lock screen resume #2169

Description

@neilfrndes

Environment:

  • Pop!_OS 24.04 LTS (COSMIC desktop)
  • cosmic-comp version: 0.1177030434724.04~0e97ddb
  • AMD Radeon 2100 GPU
  • Single LG HDR WQHD 3840x1600 ultrawide on DP-3 (two other DP connectors present but disconnected)

Related issues:

My issue appears to share the same root cause as #2153 (unthrottled compositor render loop) but with a different trigger and hardware.

Bug summary:
After resuming from the COSMIC lock screen, cosmic-comp sometimes starts consuming ~40% CPU indefinitely (for hours/days). The system becomes sluggish (obvious mouse/keyboard lag) with high I/O wait times (~22%). The only fix is restarting the compositor, which destroys all open windows and workspaces.

This does not happen every time — it tends to occur after long sessions (days of uptime) followed by a lock screen resume.

What I found:

  1. After resume, the display had dropped from the preferred 59.994 Hz to 49.985 Hz (confirmed via cosmic-randr list). Manually switching back to 59.994 Hz did not fix the CPU usage.

  2. strace on the compositor shows timerfd intervals in the microsecond range instead of the expected ~16.6ms for 60Hz vsync. The compositor is scheduling frames hundreds of times per second:

timerfd_settime(6, 0, {it_value={tv_sec=0, tv_nsec=9242}}, ...)
timerfd_settime(6, 0, {it_value={tv_sec=0, tv_nsec=16360}}, ...)
timerfd_settime(6, 0, {it_value={tv_sec=0, tv_nsec=950544}}, ...)
timerfd_settime(6, 0, {it_value={tv_sec=0, tv_nsec=1575508}}, ...)
  1. A 2-second strace captured 8,772 syscalls (~4,400/sec) in a tight epoll + DRM_IOCTL_SYNCOBJ loop — submitting and completing GPU frames as fast as possible with no vsync gate. This matches the pattern reported in High GPU utilization (40%) at idle with mixed refresh rate multi-monitor setup (NVIDIA) #2153.

  2. top -H shows the main cosmic-comp thread at ~39% CPU (state R), and the surface-DP-3 thread at ~4% CPU. Total CPU time accumulated was 253+ hours.

  3. Kernel stack shows ep_poll but the process is in R state — it wakes from epoll almost immediately each cycle.

  4. No GPU errors in dmesg. GPU driver and hardware appear healthy.

  5. Manually switching the refresh rate back to 59.994 Hz via cosmic-randr did not resolve the CPU usage — the render loop persists even after the correct mode is restored.

Expected behavior:
After lock screen resume, the compositor should re-establish vsync timing and idle at <2% CPU when nothing is animating.

Actual behavior:
The compositor loses vsync synchronization and enters an unthrottled render loop, burning ~40% CPU indefinitely until the compositor process is restarted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions