Bug 2559321
| Summary: | uresourced 0.5.4: uresourced --user drives systemd --user into a ~90% CPU livelock and job starvation when a unit has ManagedOOMPreference=omit/avoid; fixed upstream in 0.5.5, please update F44 (and F45) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Vaughan <vaughan.g.aus> | ||||
| Component: | uresourced | Assignee: | Benjamin Berg <benjamin-fedora> | ||||
| Status: | ON_QA --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 44 | CC: | benjamin-fedora, hpa | ||||
| Target Milestone: | --- | Keywords: | Desktop | ||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | --- | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | Type: | --- | |||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Created attachment 2162813 [details] Minimal reproducer against the real user manager (self-limiting, 5 s, cleans up) I can confirm this on a second machine running Fedora 44 KDE Plasma 6.8.2, so it isn't specific to GNOME: uresourced-0.5.4-5.fc44, systemd-259.10-1.fc44. Below is what the report above doesn't cover yet. See also bug 2259354 (the rawhide 0.5.5 rebase). The request stands: please build 0.5.5 for F44 and F45, or backport b9bf4467. 1. A tested minimal reproducer against the real user manager is attached (repro-uresourced-loop.sh; it stops itself after 5 s and cleans up). It uses a plain user service in app.slice with only ManagedOOMPreference=avoid, and starting it is enough. Result: about 4,600 SetUnitProperties calls from uresourced --user in 5 s, systemd --user using 4.1 s of CPU in those 5 s, and CPUWeight/IOWeight forced to 100 through /run/user/<uid>/systemd/user.control/<unit>.d/. LogFilterPatterns= (user.journald_log_filter_patterns) triggers it the same way. CPUWeight/IOWeight on their own do not. 2. The loops stack, and that's when jobs stop running. Every cgroup realize of the unit while uresourced runs (unit start, daemon-reload while it's active, set-property) adds another loop: no loop: trivial oneshot start 12-19 ms 1 loop (start): manager 87% CPU, oneshot 16-24 ms (jobs still run, so it's easy to miss) 2 loops (+ daemon-reload): manager 95% CPU, oneshot 1.7-6.8 s 3 loops: manager 96% CPU, oneshot up to 8.3 s In real use, a stop job here waited 29 minutes. This probably also explains why the reexec above only helped for a few minutes. Reexec drops the calls already in flight, and the next start of a matching app starts a new loop. 3. Stopping the unit doesn't end the loop. bus_service_commit_properties() -> unit_realize_cgroup() has no active-state check, so uresourced's next call recreates the stopped unit's cgroup (empty, and not shown in ControlGroup=) and sets the xattr again. Here it kept going at about 630 calls/s after the stop. 4. Verified workaround: a drop-in with ManagedOOMPreference=none gives 0 calls on start and on reload, and the unit keeps its own weights. Recovery that doesn't need a job: systemctl --user kill uresourced.service, then start it again. 5. Wider exposure: T3 Code's generated user service unit sets ManagedOOMPreference=avoid (https://github.com/pingdotgg/t3code/issues/20931). That's how this machine hit the bug, so stock F44/F45 installs of that app are affected until uresourced is updated. FEDORA-2026-845e0f83a5 (uresourced-0.5.6-1.fc45) has been submitted as an update to Fedora 45. https://bodhi.fedoraproject.org/updates/FEDORA-2026-845e0f83a5 FEDORA-2026-8c96aabff2 (uresourced-0.5.6-1.fc44) has been submitted as an update to Fedora 44. https://bodhi.fedoraproject.org/updates/FEDORA-2026-8c96aabff2 FEDORA-2026-845e0f83a5 has been pushed to the Fedora 45 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-845e0f83a5` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-845e0f83a5 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2026-8c96aabff2 has been pushed to the Fedora 44 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-8c96aabff2` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-8c96aabff2 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. |
**Description of problem** With uresourced 0.5.4 and systemd 259.10 on Fedora 44 Workstation (GNOME 50.6, Wayland), giving any unit under the user manager's `app.slice` a `ManagedOOMPreference=omit` (or `avoid`) drop-in makes `uresourced --user` and `systemd --user` feed each other forever: 1. systemd applies the preference by writing the `user.oomd_omit` xattr on the unit's cgroup directory. 2. uresourced's app monitor watches `app.slice` children with `IN_ATTRIB | IN_CREATE | IN_DELETE` and treats every `IN_ATTRIB` as an application change, so it recomputes and sends `SetUnitProperties(CPUWeight, IOWeight)` even though the values have not changed (`src/r-app-monitor.c` 359-363, `src/r-app-policy.c` 84-107 in v0.5.4; there is no "unchanged value" guard). 3. systemd 259 re-realizes the cgroup on every `SetUnitProperties`, which rewrites the `user.oomd_omit` xattr, which is another `IN_ATTRIB`, and so on. Because systemd's IPC event source (priority 0) outranks its job run queue (`SD_EVENT_PRIORITY_IDLE+1`), the user manager keeps answering D-Bus (so `systemctl --user` works and `SystemState=running`) but stops executing jobs: every new `app-*.scope`, test scope, timer or service start sits in `waiting` forever. From the desktop this looks like "applications no longer launch" and a fan running at full speed. This is upstream issue 9, fixed by commit b9bf4467 ("r-app-policy: avoid reconfiguring units with the same value", 2026-09-20) and released in uresourced 0.5.5 (tagged 2026-09-20). Rawhide has 0.5.5-1.fc46 (FEDORA-2026-012dfc0fae, stable since 2026-09-21), but the f44 and f45 branches are still 0.5.4 and Bodhi has no F44/F45 update. Please build 0.5.5 for F44 and F45, or backport that one commit. **Version-Release number of selected component** uresourced-0.5.4-5.fc44, systemd-259.10-1.fc44, gnome-shell-50.6-1.fc44, kernel 7.2.11-200.fc44 **How reproducible:** every time the trigger configuration is present (three sessions in two days here; the upstream reporter saw three in one day) **Steps to Reproduce** (what was done here) 1. Create drop-ins for units under `app.slice`, e.g. `~/.config/systemd/user/app-com.microsoft.VSCode-.scope.d/90-oomd.conf` containing `[Scope]` / `ManagedOOMPreference=omit` (the intent was to exempt a few scopes from systemd-oomd's `app.slice` pressure policy; `avoid` triggers it too). 2. `systemctl --user daemon-reload` while such scopes are running, or start a matching app afterwards. 3. Watch `systemd --user` CPU and `systemctl --user list-jobs`. (An untested, minimal form should be a single `~/.config/systemd/user/app-.scope.d/oomd.conf` with the same content.) **Actual results** - `systemd --user` at 92.5% of one core over a 3 s sample, state R, ~15,500 voluntary context switches in 3 s; `uresourced --user` at 21% and the session dbus-broker at 6.5% at the same time. Over the session: 8h31m CPU for the manager, 163 million voluntary context switches, nearly 2 CPU-hours for `uresourced --user`. - `systemctl --user list-jobs`: 37 jobs, all `waiting`, none `running`, no `--after/--before` blockers; `Progress=1`, `SystemState=running`. - `/run/user/<uid>/systemd/transient/app-com.microsoft.VSCode-<pid>.scope.d/50-CPUWeight.conf` kept its content (`CPUWeight=100`) but got a new inode and mtime on every 200 ms sample: six consecutive samples, six different inodes. The cgroup carried `user.oomd_omit=1`; a scope without the drop-in showed no churn. - `/proc/<uresourced pid>/fdinfo` showed the inotify watch on `app.slice` with mask `0x304` (`IN_ATTRIB|IN_CREATE|IN_DELETE`). - `systemctl --user daemon-reexec` emptied the queue for a few minutes, then CPU went back to 92-96% and new jobs piled up again. - `systemctl --user kill --kill-whom=main --signal=TERM uresourced.service`: the manager dropped to 0.0% CPU immediately and the queue drained (`uresourced.service: Consumed 19min 49.386s CPU time over 1h 37min 32.921s wall clock time`). **Expected results** No property update when the computed weights equal the ones already set; `systemd --user` idle; jobs run. **Additional info** - Isolated reproduction at the code seam: the unmodified `r-app-monitor.c`/`r-app-policy.c` from v0.5.4 and v0.5.5 compiled against a scratch directory tree and a private session bus with a tiny `org.freedesktop.systemd1` stub whose `SetUnitProperties` rewrites the `user.oomd_omit` xattr, seeded by one `user.xdg.inactive-since` xattr change: ``` 0.5.4 mode=none calls=1 xattr_rewrites=0 (500 ms window) 0.5.4 mode=omit calls=1000 xattr_rewrites=1000 elapsed_ms=80.4 (hit the 1000-call cap) 0.5.4 mode=avoid calls=1000 xattr_rewrites=1000 elapsed_ms=70.9 0.5.5 mode=omit calls=1 xattr_rewrites=1 0.5.5 mode=avoid calls=1 xattr_rewrites=1 ``` The reproducer source can be attached on request. - Workarounds that work: `systemctl --user mask uresourced.service` (loses app CPU/IO boosting), or removing the `ManagedOOMPreference` drop-ins (loses the oomd exemptions). Changing `omit` to `avoid` does not help. Reverting the `app.slice` pressure-limit override does not help either, because the xattr is the trigger, not the oomd policy. - Related: systemd issue 42991 (open) describes a similar user-manager spin on Fedora and its maintainer asked whether a client was repeatedly requesting updates; this is that client. <details> <summary>Journal excerpt (user manager, hostname removed)</summary> ``` 2026-10-21 21:19:30 systemd[<user manager>]: Started app-... (last successful start) 2026-10-21 21:20:55 systemd[<user manager>]: Reloading requested from client PID ... (drop-ins with ManagedOOMPreference=omit now in effect) 2026-10-21 21:20:55 systemd[<user manager>]: Reloading finished in 155 ms. ... from about 21:28 every start/stop job stays "waiting" ... 2026-10-22 06:40:13 systemd[<user manager>]: Reexecution requested ... Reexecuting. 2026-10-22 06:40:13 systemd[<user manager>]: Failed to start app-gnome-handy-....scope ... Failed with result 'resources' (x36 around the reexec) 2026-10-22 06:41:38 systemd[<user manager>]: Started app-gnome-handy-....scope (brief recovery) 2026-10-22 06:48:38 six jobs waiting again; manager at 92% CPU ... reboot ... 2026-10-22 10:52:06 systemd[<user manager>]: Started uresourced.service ... manager at 80-90% CPU for 1h37m ... 2026-10-22 12:29:39 systemd[<user manager>]: uresourced.service: Sent signal SIGTERM to main process ... (uresourced) on client request. 2026-10-22 12:29:39 systemd[<user manager>]: uresourced.service: Consumed 19min 49.386s CPU time over 1h 37min 32.921s wall clock time -> manager CPU 0.0% within seconds, job queue empty ``` </details> Reproducible: Always Steps to Reproduce: 1. Add a ManagedOOMPreference=omit drop-in to an app scope under app.slice. 2. Run systemctl --user daemon-reload. 3. Watch systemd --user CPU and systemctl --user list-jobs. Actual Results: systemd --user sits at 90%+ CPU, and every new job stays "waiting" forever. Masking uresourced stops it straight away. Expected Results: No CPU loop, and jobs run normally. Additional Information: more info: https://bugzilla.redhat.com/show_bug.cgi?id=2259354 Upstream fix: https://gitlab.freedesktop.org/benzea/uresourced/-/issues/9. Fedora Rawhide already has 0.5.5 Versions: uresourced-0.5.4-5.fc44, systemd-259.10-1.fc44, gnome-shell-50.6-1.fc44, kernel 7.2.11-200.fc44. Workaround: systemctl --user mask uresourced.service (confirmed working here). Related: systemd issue 42991 describes the same user-manager spin; this is the client causing it. Full evidence and journal excerpt attached.