Skip to content

Rewatch can index a retired project root #1116

Description

@lzl51230

Problem

cbm_watcher_poll_once() snapshots project-state pointers and polls without the table lock. Replacing a watch removes the old table entry but defers its free, so the old snapshot can still invoke the index callback for the retired root. If replacement overlaps that callback, a clean replacement registration may baseline without repairing the graph the old callback overwrote.

The deferred-free change avoids use-after-free but does not provide registration-generation safety.

Suggested fix

Mark removed states retired, skip retired snapshots before callbacks, and force a different-root replacement to synchronize when replacement overlaps an active callback. Add deterministic rewatch/unwatch concurrency tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions