GUI freezes when opening Settings: Device.unmount() runs a global sync on the GTK main thread and waits for all filesystems in the system
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 57/100
Direzione di ricerca
Start in src/Utility/Device.vala at the “sync before unmount” block in Device.unmount(), then trace the Settings and Wizard device probe path through check_btrfs_volume(). Confirm how unmounting flushes the target filesystem and whether removing the global sync preserves the expected behavior. Done when opening Settings or Wizard no longer blocks the GTK UI on unrelated filesystem writeback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello! We tracked down a GUI freeze in timeshift-gtk to a specific line of code and would like to share the analysis.
Describe the bug
Clicking "Settings" (or "Wizard") in the main window freezes the whole GTK window until it is killed. The freeze is not limited to the Settings dialog — no UI events are processed at all.
Root cause
Device.unmount() (src/Utility/Device.vala, the //sync before unmount block) runs a global sync before unmounting:
//sync before unmount
cmd = "sync";
Process.spawn_command_line_sync(cmd, out std_out, out std_err, out ret_val);
Two problems here:
- Bare sync flushes dirty data on every mounted filesystem in the system, not just the one being unmounted.
- spawn_command_line_sync is called on the GTK main thread, so the whole UI blocks until sync finishes.
Opening the Settings window probes the BTRFS device (check_btrfs_volume() mounts it temporarily with subvolid=0, then unmounts it), which reaches this code path. If any disk in the system has a large dirty writeback backlog, sync blocks for as long as that backlog takes to drain — the GUI hangs meanwhile, even though the slow disk has nothing to do with Timeshift.
This is similar to #232 (closed as stale), where the debug log ends at Unmounting from: '/run/timeshift/.../btrfs' — the same code path — but the underlying mechanism was never identified there.
Evidence (timeshift 26.09.0-1, Arch Linux, kernel 7.2.9-arch1-1)
During the freeze, a child sync process of timeshift-gtk sits in uninterruptible sleep (D state) for many minutes:
$ ps -eo pid,ppid,stat,etime,cmd | grep sync
838004 1 D 24:01 sync
839348 838637 D 10:47 sync # child of timeshift-gtk
Kernel hung-task reports confirm it is waiting for writeback:
INFO: The task sync:838004 has been waiting for writeback completion for more than 1305 seconds.
The cause of the slowness is an unrelated external USB SMR drive with a large writeback backlog (~17 GiB of dirty pages, ~6 MB/s sustained write):
Dirty: 17508360 kB
Writeback: 8192 kB
/proc/diskstats for that drive shows it is 100% busy writing at ~6 MB/s, so sync waits ~45 minutes. The GUI is unresponsive for the entire duration.
Expected behavior
The UI should not freeze because of unrelated disks in the system.
Suggested fix
Remove the global sync call from Device.unmount(). The umount syscall already flushes the filesystem being unmounted — a system-wide sync is redundant even for the target device, and it is actively harmful in a GUI process. If some extra safety is desired, syncfs() on the target filesystem's fd would be scoped correctly, but even that is unnecessary here since umount handles it.
Alternatively, at minimum, do not run it synchronously on the GTK main thread.
Thank you for your work on Timeshift!
- Lingua principale
- Vala
- Stelle
- 4.3k
- Fork
- 159
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di linuxmint/timeshift
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
-
License parsing with GitHubAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 50/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
timeshift --create hangs indefinitely at exit in infinite read() = 0 loop on aarch64 (Fedora 44 / Kernel 7.2.x)Forse già presa @ygerlach l’ha presa 7 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
Tutte le issue di linuxmint/timeshift
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sebastienros/jint#4282 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
topoteretes/cognee#5982 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
BurntSushi/toml#530 ·
-
Patches of derivations with `__structuredAttrs` are ignoredForse già presa @KiaraGrouwstra l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 81/100
nix-community/vulnix#184 ·