Add Loom model checking for synchronization primitives
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start with the working Loom model in the RwLock changes linked from PR 184, then review the existing unit, integration, stress, and multithreaded test infrastructure. Determine whether Loom should be adopted and which synchronization internals are in scope. Done means bounded models cover the selected synchronization cases while keeping CI execution practical.
Written by the indexing model from the issue text.
Description
As a library providing several synchronization primitives, Asyncband relies on atomic state transitions, waiter queues, and wake-up handling. Conventional unit and stress tests exercise many concurrent schedules, but they cannot systematically explore every relevant execution ordering. Rare interleavings may therefore hide missed wake-ups, leaked ownership, deadlocks, or invalid state transitions.
Loom provides deterministic model checking for concurrent Rust code. Small, focused models can systematically explore relevant interleavings and validate invariants such as:
- Readers and writers never holding incompatible ownership
- Waiter publication racing with lock release without missing a wake-up
- Cancellation before or after ownership is granted
- Queue-head cancellation preserving follower progress
- Atomic upgrade and downgrade transitions
- Correct memory ordering between lock holders
Loom can only explore concurrency performed through its own instrumented primitives. Every atomic, mutex, thread, cell, or other synchronization operation relevant to a model must therefore use the corresponding Loom type. Any synchronization left using an uninstrumented std type falls outside Loom’s scheduler and reduces the model’s coverage, however, this is for the most part covered by the existing test infrastructure. Asyncband would use conditional compilation to select Loom primitives during model checking and the existing std implementations in normal production builds.
A working draft has been added to the RwLock changes (here), where the previous semaphore-based implementation was replaced with a purpose-built atomic scheduler. The draft model-checks ownership exclusion, waiter publication, cancellation around grant, queue progress, upgrade priority, and downgrade handoff.
If the project decides not to adopt Loom, the draft can be removed from the RwLock PR before merging. If adopted, support can be expanded through separate, individual PRs for other synchronization internals, such as:
- Semaphore
- AtomicOptionBox
- Mutex scheduling
- Countdown and wait-set primitives
- Channel state machines
The models should remain small and bounded to keep CI execution practical. Loom would exist only to complement the existing unit, integration, stress, and multithreaded tests.
- Dominant language
- Rust
- Stars
- 274
- Forks
- 42
- Avg merge
- 20h 18m
- Merged PRs (30d)
- 55
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/asyncband
-
enhancement good first issue help wanted
Difficulty 5/5 Over a week Newbie friendliness 35/100
apache/asyncband#324 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement question
Difficulty 5/5 Over a week Newbie friendliness 30/100
apache/asyncband#312 · 3 comments ·
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
apache/asyncband#272 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 5/5 Over a week Newbie friendliness 38/100
apache/asyncband#252 · 1 comment ·
Maintainers usually reply within 1 day
All issues in apache/asyncband
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_tPossibly taken @andrewdunndev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Misdetection] `text/tab-separated-values` file misdetected as `text/tsv`Possibly taken @bact claimed this today. Openmisdetection needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
C-bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
vxc prints a debug line '[flat-codegen] emitted module via the flat path' on every compilePossibly taken @YodHeVauHe claimed this today. Opendevex good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day