Skip to content

🐛 [BUG] SQLite/index inconsistency window on forget() #231

Closed

Description

@ajianaz

Description

Two related concerns about SQLite-to-index consistency:

1. remember_precomputed: SQLite insert before index (line 84)

SQLite insert happens while index lock is held. If process crashes between SQLite commit and index insert, memory exists in SQLite but not in vector index. Currently acknowledged with comment — orphan is harmless, cleaned by verify/repair.

2. forget: SQLite delete before index remove (line 220)

SQLite delete happens BEFORE acquiring the index lock. If process crashes between SQLite delete and index removal, memory is gone from SQLite but remains as orphan in vector index. Again acknowledged with comment.

Both cases rely on verify/repair for cleanup, but the inconsistency windows could be narrowed.

Affected Code

  • crates/uteke-core/src/operations.rs lines 84, 220

Fix

For forget(): acquire index lock before store.delete() to narrow the inconsistency window.
For remember(): current approach is acceptable — index lock is acquired first.

Found by Cora v0.4.4 scan.

Activity

  1. added
    bug
    scope:core
    cora-scan
    on Jun 7, 2026
  2. ajianaz commented on Jun 7, 2026

    @ajianaz
    CollaboratorAuthor

    Fixed in v0.0.11 (PR #234)

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

    bugcora-scanpriority:mediumscope:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions