MangoDisk version
1.0.5
Operating system and version
macOS 26.6 (25G72), Apple Silicon
Problem description
Deep Cleanup can hang indefinitely while processing Old temporary files (system.user-temp). The UI remains responsive, but cancellation stays on Stopping cleanup... forever. Quitting or force-quitting the app is the only recovery.
This reproduced in two consecutive app sessions:
- In the first session, cleanup stopped producing progress for about 32 minutes. A cancel request was logged, but neither
cleanup_finished nor operation_finished was emitted before the app was restarted.
- In the second session, cleanup stopped on Old temporary files again. The cancel request was accepted, but the operation lock remained held and no cleanup history record was finalized.
Steps to reproduce
- On macOS, have one or more FIFO/named-pipe entries under the process temporary directory (
$TMPDIR). Developer tools can leave these naturally; the affected machine had old diagnostic/tool pipes in this directory.
- Run Deep Cleanup with Old temporary files selected.
- Cleanup reaches that rule and remains on
Processing indefinitely.
- Press Cancel.
Expected behavior
- Non-regular filesystem entries such as FIFOs and sockets are skipped or rejected without blocking.
- Cancellation completes within a bounded time.
- The operation lock is released and a truthful result/history entry is finalized.
Actual behavior
- The cleanup worker blocks in a kernel
open() call.
- The main thread and UI remain responsive.
- Cancellation is recorded but cannot be observed by the blocked worker.
- The operation lock remains held and history is not finalized.
Process-sample evidence
Two independent process samples taken several minutes apart placed the cleanup worker in the same stack for every sample:
CleanupService::execute_deep_cleanup_step_with_progress
-> execute_rule
-> delete_entry
-> prepare_path_for_permanent_delete
-> std::fs::File::open
-> open
-> __open
The worker also retained a directory handle on $TMPDIR. The directory contained multiple FIFOs with no open writer endpoints. A read-only blocking open of a FIFO waits for a writer indefinitely.
Likely root cause
On Unix, prepare_path_for_permanent_delete() calls fs::File::open(path) before checking that the captured metadata represents a regular file or directory:
https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/src/filesystem/permanent_delete.rs#L117-L177
delete_entry() checks cancellation immediately before calling that function, but the flag cannot be checked again while open() is blocked:
https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/src/cleanup/rule_execution.rs#L470-L490
The macOS temporary-files rule traverses ${temp}:
https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/rules/filesystem/macos/system/system.user-temp.toml#L13-L25
Because the matcher runs after prepare_path_for_permanent_delete(), even a FIFO that would later fail the seven-day matcher can trigger the blocking open.
Suggested repair
- Use
symlink_metadata to reject unsupported special-file types before opening the identity handle.
- On Unix, open with nonblocking and no-follow semantics (
O_NONBLOCK | O_NOFOLLOW) while preserving the existing handle/path identity and TOCTOU checks.
- Add a regression test containing a FIFO in a cleanup root and assert the call returns promptly without mutation.
- Add a cancellation-latency test for special files in
system.user-temp.
MangoDisk version
1.0.5
Operating system and version
macOS 26.6 (25G72), Apple Silicon
Problem description
Deep Cleanup can hang indefinitely while processing Old temporary files (
system.user-temp). The UI remains responsive, but cancellation stays on Stopping cleanup... forever. Quitting or force-quitting the app is the only recovery.This reproduced in two consecutive app sessions:
cleanup_finishednoroperation_finishedwas emitted before the app was restarted.Steps to reproduce
$TMPDIR). Developer tools can leave these naturally; the affected machine had old diagnostic/tool pipes in this directory.Processingindefinitely.Expected behavior
Actual behavior
open()call.Process-sample evidence
Two independent process samples taken several minutes apart placed the cleanup worker in the same stack for every sample:
The worker also retained a directory handle on
$TMPDIR. The directory contained multiple FIFOs with no open writer endpoints. A read-only blocking open of a FIFO waits for a writer indefinitely.Likely root cause
On Unix,
prepare_path_for_permanent_delete()callsfs::File::open(path)before checking that the captured metadata represents a regular file or directory:https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/src/filesystem/permanent_delete.rs#L117-L177
delete_entry()checks cancellation immediately before calling that function, but the flag cannot be checked again whileopen()is blocked:https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/src/cleanup/rule_execution.rs#L470-L490
The macOS temporary-files rule traverses
${temp}:https://github.com/harry0703/MangoDisk/blob/main/src-tauri/crates/mangodisk-core/rules/filesystem/macos/system/system.user-temp.toml#L13-L25
Because the matcher runs after
prepare_path_for_permanent_delete(), even a FIFO that would later fail the seven-day matcher can trigger the blocking open.Suggested repair
symlink_metadatato reject unsupported special-file types before opening the identity handle.O_NONBLOCK | O_NOFOLLOW) while preserving the existing handle/path identity and TOCTOU checks.system.user-temp.