8000 [needs verification] concurrency: rule registration lacks write_lock protection · Issue #94 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
< 10BC8 link rel="modulepreload" href="https://github.githubassets.com/assets/chunk-dynamic-github-ui--issues--IssueViewer-149607dbbf0141a4.js" crossorigin="anonymous" />

[needs verification] concurrency: rule registration lacks write_lock protection #94

Closed

Description

@adityamukho

Problem (needs verification)

The code treats Rule registration as "read-only" (is_write only matches Transact and Retract). The rule registration command is handled in the read-only path (no global write_lock held) and executed by a DatalogExecutor that may mutate the shared RuleRegistry. This could open a race with concurrent write transactions that hold write_lock, or with other rule registrations.

Files

  • src/db.rs — command classification & execute (is_write detection around lines ~388–392)

Impact

Concurrent registrations or concurrent mutation of rules vs writes could produce inconsistent view/order of rules vs facts and subtle concurrency bugs.

Suggested Fix

  • Treat rule registration as a write (include DatalogCommand::Rule in the list that requires acquiring write_lock), or
  • Ensure rule registration obtains the appropriate exclusive lock (e.g., upgrade to write lock for the rules RwLock)

Labels: concurrency, medium-priority, needs-verification

Activity

  1. added
    stability
    on Apr 6, 2026
  2. added 2 commits that reference this issue on Apr 6, 2026
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

    stability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      2BF7
      0