omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Suspend retries in a loop when gvfsd-trash hangs on a FUSE lookup during the unmount-fuse sleep hook

Open edneymatias opened this issue 2 weeks ago • 4 comments

System details

Lenovo LOQ 15IAX9E (83ME), Intel Alder Lake-HX + NVIDIA RTX 4050 Mobile (hybrid), mem_sleep = deep Omarchy omarchy-settings 4.5.0-3 (includes #14496), kernel 7.2.15-1-omarchy, systemd 262.1, gvfs 1.62.0-3, fuse3 3.18.3, nvidia-open-dkms 615.78.08

What's wrong?

Sometimes, closing the lid never suspends the machine. A gvfsd-trash worker thread gets stuck in an uninterruptible FUSE lookup, and the kernel then fails to freeze user space on every attempt. systemd-logind keeps retrying, about every 20 seconds and alternating deep and s2idle, until the lid is opened. Even SIGKILL from systemd can't end the stuck thread, so the next suspend fails the same way until reboot.

This happened twice in one boot: 14:09 to 14:15 and 16:35 to 16:51. It added up to 60 Freezing user space processes failed messages. Three suspends earlier the same day worked, and so did two after a reboot, so the failure is intermittent.

Every attempt fails like this:

PM: suspend entry (deep)
Freezing user space processes failed after 20.006 seconds (1 tasks refusing to freeze, wq_busy=0):
task:Trash Worker Th state:D stack:0 pid:1064938 tgid:1064908 ppid:935770 task_flags:0x400040 flags:0x00080802
Call Trace:
 <TASK>
 __schedule+0x40f/0x1780
 schedule+0x27/0xa0
 request_wait_answer+0xe2/0x2f0
 fuse_chan_send+0x1d0/0x310
 fuse_lookup_name+0x190/0x340
 fuse_lookup+0xb6/0x1d0
 lookup_slow+0x6e/0x120
 path_lookupat+0x258/0x3f0
 filename_lookup+0x129/0x230
 __do_sys_newfstatat+0xc5/0x2b0
 do_syscall_64+0xaa/0x630
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
 </TASK>
...
systemd-sleep: Failed to put system to sleep. System resumed again: Device or resource busy

How it starts:

14:09:44 systemd-logind: Lid closed.
14:09:50 systemd: run-user-1000-gvfs.mount: Deactivated successfully.   <- unmount-fuse "pre" (fusermount -uz)
14:09:50 kernel: PM: suspend entry (deep)
14:10:12 kernel: Freezing user space processes failed ... task:Trash Worker Th state:D
14:10:35 systemd: Started [systemd-run] systemctl --user restart gvfs-daemon.service   <- unmount-fuse "post"
14:10:35 kernel: PM: suspend entry (deep)    <- logind retries; the same task blocks again
...
14:12:43 systemd[user]: gvfs-daemon.service: Killing process 1064908 (gvfsd-trash) with signal SIGKILL.
14:14:32 systemd[user]: gvfs-daemon.service: Unit process 1064908 (gvfsd-trash) remains running after unit stopped.

The stuck thread is in __do_sys_newfstatat, waiting on a FUSE request. The gvfsd-trash process (pid 1064908) was spawned within seconds of the hook's lazy unmount; its PID is right next to systemd-sleep's. That points to the trash backend reacting to the mount change by stat-ing a path whose FUSE daemon never answers. I haven't pinned down which mount. The lookup could go to the lazily detached gvfsd-fuse connection, or to /run/user/1000/doc.

Each failed attempt also runs nvidia-suspend and nvidia-resume. After a few cycles Chromium died while exiting. Its disk$0 thread hung in nvidia_uvm teardown (uvm_va_space_mm_shutdown, which also refused to freeze), and then came a burst of NVRM: clientUnmapResourceRefMappings: Failed to auto-unmap (status=0x23). Chromium wouldn't start again after that, and the session finally hung, which needed a forced power-off. Without the suspend loop none of that would have happened.

Notes

  • #14496 made the post-resume gvfs-daemon restart actually run. Before it, the restart was killed with the sleep unit. So "lazy-unmount, then restart gvfs on every resume" is new in 4.5.0. Its tests covered successful suspends. This failure is about what happens when the freeze fails and logind retries.
  • This hook has been installed here since 2026-11-05 (4.5.0-3). The boots from then until 11-12 had many successful suspends and no refusing to freeze messages, so the trigger is a race, not something that breaks every time.
  • GNOME/gvfs#715 has the same mechanism (gvfsd-recent blocking the freeze in a FUSE request), which suggests gvfs backends calling into FUSE during the freeze is a general hazard.

Possible directions

  • Have the hook check for gvfs processes in D state before sleeping, or skip the lazy unmount when one exists.
  • Make the retry loop visible to the user. Right now a laptop with its lid closed just keeps waking every 20 s and draining the battery.

edneymatias avatar Nov 12 '26 20:11 edneymatias

I read the report, the current unmount-fuse hook, and its existing test on quattro at d54cde78f. The supplied trace shows a FUSE lookup blocking process freezing, but does not identify which FUSE mount is involved. No reproduction or tests were run, and no fix was filed.

Reviewed by GPT-6 High in Codex. I classified this as a bug, but the second classifier, deepseek-v4p1-flash, returned no answer. Classification remains unsettled, so this is left unlabelled for maintainer review; no second review of the diagnosis was performed.

omarchybot avatar Nov 19 '26 03:11 omarchybot

The classification is now agreed as bug. I exercised the unchanged hook from current quattro at 8f62c7683c on a disposable Omarchy worker with the same gvfs 1.62.0-3 and fuse3 3.18.3 versions. Three freezer-only suspend cycles with gvfsd-trash active completed without a blocked trash thread; the CLI checks and all three existing hook checks passed. This did not exercise your Lenovo/NVIDIA hardware, physical lid or actual device suspend, so it does not rule out the reported race.

The missing evidence is which FUSE connection the trash worker is waiting on, and whether that wait starts before or after the hook unmounts the gvfs gateway. No fix was filed because neither connection nor ordering is established.

After opening the lid to stop another occurrence, please capture these before rebooting, if the session still responds:

  • The complete journal from just before lid close through lid reopen, including kernel, logind and user-service messages, with monotonic timestamps (sudo journalctl -b -o short-monotonic).
  • The thread states (ps -eLo pid,tid,stat,wchan:32,comm) and /proc/<trash-worker-TID>/stack read with sudo, using the TID from that occurrence.
  • /proc/<gvfsd-trash-PID>/mountinfo and the values of /sys/fs/fuse/connections/*/waiting, read with sudo if necessary. Together these may narrow down the connection; they do not by themselves identify the blocked pathname.

Please also say which network, cloud or removable mounts were active. Passive capture after an occurrence is enough; there is no need to trigger repeated failing suspends for this request. This is waiting on that reporter evidence.

Reviewed by GPT-6 High in Codex only. The second opinion from Opus 5.5 High could not run because its weekly usage limit was reached; its availability check also failed.

omarchybot avatar Nov 23 '26 11:11 omarchybot

Second occurrence, different machine — evidence that the stuck lookup is not on a gvfsd-fuse connection

Same failure on omarchy-settings 4.5.0-3, kernel 7.2.15-4-omarchy, gvfs 1.62.0-3, fuse3 3.18.3. Lid closed 2026-11-28 16:39, opened 2026-11-29 10:32: 1,513 failed suspends, each blocked by a gvfsd-trash thread in D state in request_wait_answer (via both fuse_lookup from newfstatat and fuse_dentry_revalidate from statx). The boot ended before /proc data could be captured, so this is all from the journal.

  • The blocked request outlives every gvfsd-fuse. At 08:52:26 systemd SIGKILLed gvfsd-fuse 250974; by 08:54:07 the only process left in gvfs-daemon.service was gvfsd-trash 249670, yet its worker stayed in D state until 09:13:44 (~20 more failed freezes). Same pattern after the gvfsd-fuse SIGKILL at 07:00:49 (stuck worker of 226023 persisted until 07:03:31). With no gvfsd-fuse process alive, every gvfsd-fuse connection — including any lazily detached one — would be aborted and its pending requests failed, so the lookup appears to be on another FUSE mount. Here the candidates are fuse.portal (/run/user/1000/doc) and fuse.rclone (an rclone OneDrive mount) — the network was down for the whole loop, since NetworkManager unmanages wifi on every attempt.
  • It is not one stuck thread until reboot; the hook re-arms it. Each post-hook systemctl --user restart gvfs-daemon.service starts a fresh gvfsd-trash, which becomes the next stuck task: 44 successive instances handed off ~20 s apart over 17 h, while gvfs-daemon.service did ~327 start/stop cycles with 295 final-sigterm timeouts. Stuck workers did eventually release (typically after ~30 min), but the next instance blocked straight away.
  • Side effect: gvfsd-fuse SIGSEGV. At 07:17:23 the unit was started and stopped within the same second, and gvfsd-fuse crashed during FUSE init. Symbolized: g_object_ref ← g_mount_tracker_set_property (gmounttracker.c:339) ← g_mount_tracker_new ← g_daemon_volume_monitor_init (gdaemonvolumemonitor.c:202) ← vfs_init (gvfsfusedaemon.c:2472) ← fuse_fs_init. That is an upstream gvfs startup race, but the restart churn from this hook is what exposes it.

Filed by Claude Opus 5.5 via Claude Code.

fliptbit avatar Nov 29 '26 09:11 fliptbit

I checked the new journal summary against quattro. The sleep hook schedules a full GVfs restart even after a failed suspend, so it can add to the churn after the first failure. The GVfs trash watcher normally skips the document portal and can scan rclone mounts. That makes rclone a lead on the second machine. Older rclone freeze report

If the journal is still available, please share a redacted short-monotonic excerpt from lid close through the first two failed attempts, including the kernel, logind, GVfs and any rclone entries. If it recurs and the trash thread is still blocked after opening the lid, please capture sudo findmnt -N <trash-PID> -t fuse,fuse.rclone,fuse.gvfsd-fuse,fuse.portal -o TARGET,FSTYPE,MAJ:MIN and sudo grep -H . /sys/fs/fuse/connections/*/waiting while it is stuck. The mount’s device number can connect a persistent queue to its filesystem.

Reviewed by GPT-6 High in Codex and Opus 5.5 High, based on the report and source. Opus 5.5 High suggested matching the mount device number to the FUSE waiting counter. The earlier stock worker test did not reproduce this configuration.

omarchybot avatar Nov 29 '26 10:11 omarchybot