Skip to content

cosmic-app-library consumes 1.6–2.1 GiB RAM per launch, leading to compositor GL corruption and system hang #237

Description

@jeremy-g-davenport

Linked Issue: https://github.com/SvitloLinux-pkgs/cosmic-applibrary/issues/1

Summary

Opening the COSMIC app library (Super key / app grid) allocates 1.6–2.1 GiB of RAM per session. Memory is released when the launcher closes, but repeated use within a session causes progressive GL state corruption in cosmic-comp, eventually leading to a display freeze that requires a hard reboot.

Environment

Distro CachyOS (rolling, Arch-based)
Kernel 7.0.11-1-cachyos
cosmic-app-library 1:1.0.15-1.1
cosmic-comp 1:1.0.15-1.1
GPU AMD (amdgpu driver)
RAM 62 GiB total, 94 GiB swap
Display server Wayland (COSMIC compositor)

Steps to Reproduce

  1. Boot into COSMIC desktop
  2. Open the app library (Super key or panel icon) several times throughout the day
  3. Leave it open for any length of time (>30 seconds)
  4. Repeat 5–10 times over a few hours

Observed Behavior

Memory usage per launch (systemd cgroup accounting)

Each time cosmic-app-library is opened and closed, systemd records a peak memory allocation in the 1.6–2.1 GiB range. Nine launches were recorded on the affected day:

Launch 1   12:53   1.9 GiB   open 6m 41s
Launch 2   13:03   1.8 GiB   open 1m 5s
Launch 3   13:09   1.6 GiB   open 53s
Launch 4   13:16   1.8 GiB   open 3m 42s
Launch 5   13:28   2.1 GiB   open 3m 38s  ← highest
Launch 6   13:34   1.7 GiB   open 3m 24s
Launch 7   13:52   1.6 GiB   open 15m 41s
Launch 8   14:48   1.9 GiB   open 1m 15s
Launch 9   15:14   2.0 GiB   open 7m 30s

Total: ~16.4 GiB allocated across 9 launches (even on a 62 GiB system this represents significant GPU/memory bus pressure).

GL errors in cosmic-comp begin after first few app library launches

Starting around 40 minutes after the first launch, cosmic-comp begins emitting repeated OpenGL errors indicating out-of-bounds texture uploads:

[GL] GL_INVALID_VALUE in glTexSubImage2D(yoffset 0 + height 319 > 283)
[GL] GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 128 > 96)
[GL] GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 112 > 96)

These errors appear every 5–20 minutes and continue for the rest of the session. The height 319 > 283 and width 128 > 96 values suggest a texture atlas or icon cache is being written with dimensions that exceed the allocated texture size — a classic sign of a mismatched buffer reuse after a resize or DPI change.

Session hangs irrecoverably

Approximately 15 minutes after the final app library launch, the system froze completely:

  • Display frozen, no input response
  • No kernel panic, no OOM kill events in journal
  • Journal stopped without a shutdown sequence
  • System required hard power cycle (~37 min later)

Expected Behavior

  • Opening the app library should not require 1.6–2.1 GiB of RAM regardless of how many applications are installed
  • Closing the app library should release all allocated resources cleanly
  • The compositor should not accumulate GL errors across app library open/close cycles

Additional Context

Why this leads to a hard hang

The hang appears to be caused by the combination of:

  1. GL state corruption in cosmic-comp accumulating from repeated app library launches
  2. amdgpu.gpu_recovery being disabled by default on CachyOS (/sys/module/amdgpu/parameters/gpu_recovery = -1), preventing the GPU driver from recovering from a hung command submission

When the corrupted GL state eventually causes a GPU hang, no recovery is attempted and the display freezes permanently. With amdgpu.gpu_recovery=1, the GPU can reset and recover; the freeze becomes transient rather than permanent.

Possible cause in cosmic-app-library

The app library appears to load all installed application icons at launch. The 1.6–2.1 GiB allocation likely reflects loading every icon (potentially at multiple resolutions or with texture deduplication disabled) into GPU-accessible memory. The glTexSubImage2D errors in the compositor suggest the icon textures are being rendered with dimensions that diverge from what was allocated — possibly because icon sizes are computed at launch time and then the compositor receives different dimensions during rendering.

Workaround

Avoid opening the app library repeatedly in a single session. If the system hangs, enable AMDGPU GPU recovery to make hangs recoverable:

echo "options amdgpu gpu_recovery=1" | sudo tee /etc/modprobe.d/amdgpu.conf
sudo mkinitcpio -P

Logs

See attached files:

  • memory-peaks.txt — full systemd cgroup memory accounting for each CosmicAppList session
  • cosmic-comp-gl-errors.txt — all GL errors from cosmic-comp on the affected day
  • journal-excerpt.txt — condensed journal from the 3 hours before the hang

cosmic-comp-gl-errors.txt
journal-excerpt.txt
memory-peaks.txt

Note for maintainers: This bug exists in the upstream cosmic-applibrary repo (SvitloLinux/cosmic-applibrary). The gpu_recovery configuration issue is CachyOS-specific and may warrant a separate packaging note or default kernel parameter change. Both issues interact to produce the hard hang.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions