Repository navigation
Description
Summary
[storage] keep_audits never retires crawls whose audit process was killed before the analyze step (status crawled, or running for older ones). On a host where audits are occasionally killed (watchdog, OOM, deploy), these abandoned crawls pile up forever, and project.db grows until the next audit becomes slow enough to be killed again.
Repro (v0.0.117, macOS)
# squirrel.toml
[project]
name = "oh-repro-retire"
url = "https://shopware.dev.one-dot.io"
[storage]
keep_audits = 1
[crawler]
max_pages = 15- Run
squirrel audit https://shopware.dev.one-dot.io -C surface -f json -o out.json --no-publish --debugthree times andkill -9each one as soon as the log printsstep 1.5+2: pre-rules walk. - Run the same audit once more to completion (
✓ Audited 15 pages). - Inspect
~/.squirrel/projects/oh-repro-retire/project.db:
{"id":"7021c515","status":"crawled","retired":0,"pages":15}
{"id":"8fe2e74a","status":"crawled","retired":0,"pages":15}
{"id":"cd60f577","status":"crawled","retired":0,"pages":15}
{"id":"cef2165e","status":"analyzed","retired":0,"pages":15}
squirrel self disk --prune --keep 1 --project oh-repro-retire --dry-run lists exactly those 3 as retirable, so the manual path knows about them; the automatic keep_audits retirement after a successful audit does not.
Actual (production)
One project with a 15,000-URL sitemap: 36 crawls in project.db (keep_audits = 3), 22,887 pages rows, 1,057,882 sitemap_urls rows, 2.3 GB. The silent pre-rules phase of a 104-page audit then took longer than our 5-minute no-output watchdog, which killed it and added yet another orphaned crawl. Other projects: 5.5 GB, 2.2 GB, 1.5 GB.
Expected
The keep_audits retirement at the end of a successful audit also retires older crawls that never reached analyzed (or at least those older than the newest kept audit), the same set self disk --prune finds.
Nice to have
A progress line during the pre-rules walk (it can run for minutes without any stdout in non-TTY mode), so supervisors can tell a slow phase from a hang.
Tested: 0.0.117 (repro), 0.0.115–0.0.117 (production).
Acceptance Criteria
- After a successful audit with
[storage] keep_audits = N, crawls left inrunning,paused,stoppedorcrawledthat are older than the newest finished audit of the project and have had no activity (no page fetched) for 30+ minutes are retired too: killed crawls become eligible 30 minutes after their last activity, so the next audit or prune after that wait retires them (the issue's repro, with the 30-minute wait, ends with 1 non-retired renderable audit plus the 3 killed ones retired, not 4 live rows) - The newest crawl, and any non-finished crawl newer than the newest finished audit, is never retired by the automatic pass (it may be a live or resumable audit)
- Orphaned crawls no longer count toward the
keep_auditswindow and never take a slot from a finished audit -
squirrel self disk --prune --keep N --project <p> --yeson a project containing killed-audit crawls retires them and the old finished audits, and exits 0 instead of throwingRefusing to retire ... not finished -
--pruneacross many projects continues past a project that fails (locked db, unreadable, low disk for VACUUM), prints a per-project line with the reason, prints a final summary (retired / skipped / failed counts, bytes reclaimed), and exits non-zero only when at least one project failed -
--prune --dry-runlists abandoned crawls separately from finished audits, with each crawl's status and age, and deletes nothing - A crawl that looks live (non-finished and newer than the newest finished audit) is skipped with a stated reason in
--pruneoutput, not an abort -
squirrel auditresume (--resume) of arunning/paused/stoppedcrawl still works for the newest crawl of a base URL, andsquirrel crawlthensquirrel analyzeon the newestcrawledcrawl still works - Existing project databases need no manual step: the fix works on a
project.dbwritten by v0.0.115 to v0.0.117, and any schema change is an additive migration - The six stuck projects' scenario (36 crawls, 1M
sitemap_urlsrows) reclaims the file size after one--prune --keep 3, verified by a fixture or measured run - Tests cover: abandoned-crawl selection, retention retiring orphans, prune continuing after a per-project failure, exit codes, dry-run output, and the resume/analyze exclusions
- User-facing docs for
self diskand[storage] keep_auditsdescribe abandoned crawls and the new prune summary/exit codes (make validatepasses), and the CHANGELOG has an entry
Activity
deniskern commentedon Oct 19, 2026
Follow-up: the manual path does not help either. On the production project,
squirrel self disk --prune --keep 3 --project <p> --yes(v0.0.117) aborts the whole prune:The "not finished" crawls are the ones whose audit process was killed days ago (status
crawled/running, no process alive). So once a project has a single killed audit, neitherkeep_auditsnorself disk --prunecan ever reclaim it; 6 of our 73 projects are in that state. Expected: crawls with no live owner (or older than the newest finished audit) count as abandoned and are retirable, or prune skips them and retires the rest instead of aborting.fix(storage): retire an orphan only after 30 minutes without activity #…
fix(storage): retire crawls from killed audits; prune continues past …
fix(storage): retire an orphan only after 30 minutes without activity #…
fix(storage): retire crawls from killed audits; prune continues past …
fix(storage): retire an orphan only after 30 minutes without activity #…
fix(storage): skip a crawl that went live instead of aborting the pas…
nc9 commentedon Oct 20, 2026
Hey Denis, thanks again for the detailed report. This is fixed on main and ships in the next release (0.0.119). Crawls from killed audits are now retired by
keep_auditsand byself disk --pruneonce they've been idle for 30 minutes, so after upgrading the next audit or prune reclaims your stuck projects. Prune also carries on past a project it can't handle, and tells you what it skipped and why. One thing to know: stopped and paused crawls (the ones--resumecontinues) are kept for 7 days. The pre-rules progress line is a fair ask and we'll track it separately. And your og:image report on hreflang alternates is next in our queue.fix(cli): retire abandoned crawls and make self disk --prune robust s…