Bug description
SnapshotService::cleanup_stale_snapshots() exists in
crates/aionui-file/src/snapshot_service/mod.rs (with the doc comment
"Call once at application startup"), but it is never called anywhere in
the codebase. Leftover aionui-snapshot-* directories in the system temp
dir therefore accumulate forever.
Impact
On Windows (and any OS), every server start creates a new snapshot dir.
Because temp_repo_path() uses DefaultHasher (random per-process seed),
the generated dir name differs on every run, so the "clean up same-name old
dir" logic in init_snapshot_repo() never matches a previous run's dir.
When a process exits non-cleanly (crash / kill), the snapshot dir is left
behind and is never removed. Users can lose multiple GB of C: drive space
over time.
Steps to reproduce
- Start aioncore server.
- Trigger a workspace snapshot (file snapshot API).
- Kill the process without graceful shutdown.
- Repeat a few times.
- %TEMP%\aionui-snapshot-* dirs keep piling up and are never cleaned.
Expected behavior
Stale aionui-snapshot-* dirs are removed when the application starts
(as the doc comment of cleanup_stale_snapshots() intends).
Proposed fix
Call SnapshotService::cleanup_stale_snapshots() once in the server
startup path in crates/aionui-app/src/main.rs, None => arm of
async_main, after bootstrap::init_environment(...) (after the
data-dir instance guard is acquired), before serving.
Patch:
// crates/aionui-app/src/main.rs
None => {
let mut env = bootstrap::init_environment(&cli, &merged_path)?;
// Remove leftover aionui-snapshot-* dirs from previous runs that
// did not exit cleanly (the snapshot service only cleans up on
// graceful shutdown).
aionui_file::SnapshotService::cleanup_stale_snapshots();
// Acquire the data-dir process-level guard before binding a port
...
}
Note: please verify aionui_file is a dependency of aionui-app
(otherwise add it to Cargo.toml), or place the call where
SnapshotService is constructed.
Workaround for existing installs
Until a fixed build ships, a scheduled task can run the equivalent cleanup
daily:
powershell
$tempDir = [System.IO.Path]::GetTempPath()
$cutoff = (Get-Date).AddDays(-1)
Get-ChildItem -Path $tempDir -Directory -Filter "aionui-snapshot-*" |
Where-Object { $_.LastWriteTime -lt $cutoff } |
Remove-Item -Recurse -Force
Environment
- AionCore version: v0.1.52 (bundled with AionUi)
- OS: Windows x86_64
Bug description
SnapshotService::cleanup_stale_snapshots() exists in
crates/aionui-file/src/snapshot_service/mod.rs (with the doc comment
"Call once at application startup"), but it is never called anywhere in
the codebase. Leftover aionui-snapshot-* directories in the system temp
dir therefore accumulate forever.
Impact
On Windows (and any OS), every server start creates a new snapshot dir.
Because temp_repo_path() uses DefaultHasher (random per-process seed),
the generated dir name differs on every run, so the "clean up same-name old
dir" logic in init_snapshot_repo() never matches a previous run's dir.
When a process exits non-cleanly (crash / kill), the snapshot dir is left
behind and is never removed. Users can lose multiple GB of C: drive space
over time.
Steps to reproduce
Expected behavior
Stale aionui-snapshot-* dirs are removed when the application starts
(as the doc comment of cleanup_stale_snapshots() intends).
Proposed fix
Call SnapshotService::cleanup_stale_snapshots() once in the server
startup path in crates/aionui-app/src/main.rs, None => arm of
async_main, after bootstrap::init_environment(...) (after the
data-dir instance guard is acquired), before serving.
Patch:
Note: please verify aionui_file is a dependency of aionui-app
(otherwise add it to Cargo.toml), or place the call where
SnapshotService is constructed.
Workaround for existing installs
Until a fixed build ships, a scheduled task can run the equivalent cleanup
daily:
Environment