Skip to content

fuzz: add concurrent_sessions and concurrent_rollback targets - #976

Open
citizen-stig wants to merge 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/fuzz-concurrency
Open

citizen-stig wants to merge 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/fuzz-concurrency

Conversation

@citizen-stig

Copy link
Copy Markdown
Contributor

Every existing fuzz target drives the database from one thread with one session at a time. Nothing exercises coexisting sessions, commits waiting on them, or rollbacks racing with sessions on other threads.

This adds two targets with a shared harness (fuzz_targets/concurrent/mod.rs). Each round releases 2–4 threads. Each thread runs sessions with reads, writes, proofs, nested sessions and Nomt::read, and ends each session with a blocking, non-blocking or overlay commit, or a drop. Pauses widen the race windows. Commit concurrency, I/O workers and warm-up are randomized, and a round may reopen the database.

  • concurrent_sessions: commits race each other for the write lock.
  • concurrent_rollback: adds rollbacks from any thread with a 1–8 entry rollback log. Commits and rollbacks queue on a harness lock (never taken while holding a session), so each rollback's outcome is known.

Checks:

  • a session's reads, proofs, nested sessions and Nomt::read under it match the state its prev root names
  • a finished session's root matches a root computed from the model
  • a commit fails only as stale, and only once the root has moved
  • successful commits and rollbacks chain from the empty trie to the current root
  • the database matches the model after every round and after every reopen

These targets found the bugs fixed in #973, #974 and #975, so they fail until those land.

🤖 Generated with Claude Code

Every existing target drives the database from one thread, one session at
a time, so nothing exercised coexisting sessions, commits waiting on them,
or rollbacks racing with sessions on other threads.

Both targets share a harness that releases 2-4 threads per round. Each
thread runs sessions with reads, writes, proofs, nested sessions and
`Nomt::read`, ending in a blocking, non-blocking or overlay commit, or a
drop, with pauses that widen the race windows. Commit concurrency, I/O
workers and warm-up are randomized, and rounds may reopen the database.

Checks:
- a session's reads, proofs, nested sessions and `Nomt::read` under it
  match the state its prev root names
- a finished session's root matches a root computed from the model
- a commit fails only as stale, and only once the root has moved
- successful commits and rollbacks chain from the empty trie to the
  current root
- the database matches the model after every round and reopen

concurrent_sessions lets commits race for the write lock. concurrent_rollback
adds rollbacks from any thread with a 1-8 entry rollback log; commits and
rollbacks queue on a harness lock (never taken while holding a session) so
each rollback's outcome is known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@citizen-stig
citizen-stig marked this pull request as ready for review November 9, 2026 08:03
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