Skip to content

0.41: new API to unload revisions and keep memory / disk size bounded. - #78

Merged
MathisWellmann merged 2 commits into
mainfrom
unload
Sep 19, 2026
Merged

MathisWellmann merged 2 commits into
mainfrom
unload

Conversation

@MathisWellmann

Copy link
Copy Markdown
Owner

No description provided.

@MathisWellmann MathisWellmann self-assigned this Sep 19, 2026
@github-actions

Copy link
Copy Markdown

Summary

Adds host-driven revision unloading (unload_revision, retain_revisions, Unloaded, tombstoned registry, new error variants, REVISION_UNLOADS metric) plus a thorough integration test. The registry/dedup/handle-pinning mechanics check out (dedup skips tombstones, files delete on last Arc drop, dev-deps and Revision::new/crate_dir() exist), but the active-revision guard has a check-then-act race.

Issues

  • symbiont/src/runtime.rs:2146 (major) — unload_revision checks revision == self.active_revision() before taking the write lock, then slot.take()s under it. A concurrent activate_revision(revision) can publish that revision's pointers in the gap, so the unload unmaps and deletes the dylib the dispatch pointers now execute; the next evolvable! call is UB/crash. The documented "active revision is refused" guarantee is not enforced atomically with the unmap. Fix: re-check active inside the write-lock critical section (ideally guard active with the same lock).
  • symbiont/src/runtime.rs:2220-2233 (major) — retain_revisions snapshots loaded_revisions() and active lock-free, then unloads one revision at a time; if the active revision changes mid-loop (or a lock poisons), the ? aborts with Err after some dylibs are already unmapped and deleted, and the built unloaded vec is dropped with the error, so the caller cannot learn which ids were actually released. Fix: carry the partially-unloaded ids in the error path (e.g., report_error!-style context or a (Vec<Revision>, Error)), and re-validate active per unload.

@MathisWellmann
MathisWellmann merged commit 19ba9f3 into main Sep 19, 2026
5 of 6 checks passed
@MathisWellmann
MathisWellmann deleted the unload branch September 19, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant