Repository navigation
Description
Fix status (2026-10-19)
Released in SILO 20261018000000.
- Fix: 0f9199e0c.
- Merge: 4189869e4.
- Released source:
0cd388c666f8211f552604ae73448a066e9c25ce; the fix is present on GitHub main and in the published binaries and images.
The fix replaces parent age checking and renaming with nonrecursive removal. The existing child traversal skips parents containing recent or unreadable uploads, avoiding unnecessary removal attempts. A concurrently created upload prevents removal of its nonempty parent. Upload expiry rules, deadlines, and throttling are preserved. Production code decreases by six lines, with no new locks, scans, dependencies, or configuration.
Validation passed on the local merge: cleanup regression tests, a controlled real-upload concurrency probe under the race detector, make verifiers, and make build with the executable reporting merge commit 4189869e4. The optional typos check was skipped because the tool was not installed. The concurrency probe confirms that an upload created and written while parent cleanup is paused remains usable and completes after cleanup resumes.
Cost review on local macOS arm64, using real filesystem operations, the real disk wrapper, default throttling, and medians of three samples:
| Per cleanup pass | Before | Final fix |
|---|---|---|
| Scan 10,000 live hash directories | 0.82 s | 0.81 s |
| Allocated memory for that live-directory scan | 43.4 MB | 15.8 MB |
| Clean 1,000 expired uploads | 3.10 s | 4.16 s |
The expired-upload pass now also removes the empty parents; the old pass leaves that work for later. This additional background cleanup cost was accepted. Unreadable legacy uploads remain in place instead of being removed indirectly through an old parent. These are local measurements, not a production throughput guarantee.
Expected Behavior
When cleanupStaleUploadsOnDisk removes the last expired upload from a multipart hash directory (.minio.sys/multipart/<shaDir>/), it should also remove that now-empty directory in the same pass. A hash directory containing another upload must remain intact.
Current Behavior
The expired upload is moved to .minio.sys/tmp/.trash/<uuid>, but the empty hash directory remains for another expiry period. With the defaults, that is at least another 24 hours, followed by the next cleanup scan (normally scheduled every 6 hours). Scan duration, restarts, and further directory changes can extend that delay.
The cause is the order of operations:
renameAllmoves an expireduploadIDDirout ofshaDir, updating the parent directory's filesystem mtime.- The cleanup then calls
StatVolonshaDir;xlStorage.StatVolputs the directory's mtime inVolInfo.Created. time.Since(vi.Created) < staleUploadsExpiryis now true, so cleanup skips the empty parent.
Relevant code at published baseline 86fb2b833fb77146549f9170d9c460bfae2550bf (the cleanup code is identical to the initially reproduced local revision bb60871f57c0a590539fb0eef058e66dcaec49e4):
- Upload cleanup followed by parent-age check
- StatVol uses directory mtime as Created
- Default 6-hour interval and 24-hour expiry
Steps to Reproduce
Use a temporary directory and the real cleanupStaleUploadsOnDisk function in a package-level Go test:
- Create
.minio.sys/multipart/<shaDir>/<UUID>x<UnixNano>/, with the timestamp in the upload ID older thanstaleUploadsExpiry. - Set the parent
shaDirmtime to an old value as well. - Supply a local disk whose
Endpoint().Pathis the temporary root and whoseStatVolreports the actual filesystem mtime, then callcleanupStaleUploadsOnDiskonce. - Verify that the expired upload is gone, but its parent still exists, is empty, and has a fresh mtime.
- Run cleanup again immediately: the empty parent remains. Advance the parent's mtime past the expiry threshold and run cleanup again: the parent is finally moved away.
A fresh reproduction at the baseline above produced:
expired child removed; empty parent retained; actual parent mtime age=1.442046ms
aging the empty parent past expiry lets a later pass remove it
This exercised the actual cleanup function and real filesystem operations through a temporary Go test overlay. No production data or production timestamps were changed.
The existing cleanup test does not catch the problem: its StatVol stub always returns time.Now(), and the assertions only check the upload directory rather than the empty parent. See the current test.
Context
The verified impact is unnecessary retention of empty directories and their inode/metadata and directory-scan overhead, especially when many distinct object keys have expired multipart uploads. This finding does not show retained upload payloads in the empty hash directories, permanent leakage, or user data loss.
Reported by the maintainer from a Gemini review and independently reproduced against current SILO source.
Possible Solution
After scanning and expiring child uploads, replace the parent StatVol / age-check / Rename block with a best-effort, nonrecursive Remove(shaDir), keeping the existing deadline worker and cleanup throttling. Reuse the existing child scan to skip parents with recent or unreadable uploads, avoiding unnecessary removal attempts. The filesystem rejects removal of a nonempty directory, so another upload keeps its parent in place. A fresh empty directory does not need another expiry period.
Regression coverage should check same-pass removal after the last expired child, already-empty directories regardless of age, and preservation of a recent upload sharing a directory with an expired upload. Use real filesystem timestamps rather than a constant time.Now() stub.
Regression
Inherited behavior, present in the current baseline. The parent-age check and parent rename already appear in the upstream history preceding the SILO fork.
Your Environment
- Source:
pgsty/siloatbb60871f57c0a590539fb0eef058e66dcaec49e4 - Reproduction: package-level test calling the actual cleanup function; local temporary filesystem
- OS: macOS 27.0.1, arm64
- Go:
go1.27.2 darwin/arm64 - This reproduction is local filesystem evidence, not a deployed Linux cluster acceptance result.
Activity
Vonng commentedon Oct 19, 2026
Fixed in 0f9199e0c, merged to main, and included in 20261018000000.
Cleanup removes empty parents in the same pass while preserving live, unreadable, and concurrently created uploads. Cleanup regressions and the real-upload race probe passed. This closes the empty-directory issue; multipart enumeration and cancellation limitations remain tracked in #79.