Skip to content

Fix read_pos race condition and add dev tooling - #1

Merged
hasanzakeri merged 2 commits into
mainfrom
fix/race-condition
Mar 12, 2026
Merged

hasanzakeri merged 2 commits into
mainfrom
fix/race-condition

Conversation

@hasanzakeri

@hasanzakeri hasanzakeri commented Mar 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bug fix: Both push (overwrite path) and pop used plain store on read_pos. When the producer overwrites while the consumer is mid-pop, the consumer's store could move read_pos backwards, causing skipped values and gaps larger than buffer capacity. Fixed by using compare_exchange_weak on both sides.
  • Dev tooling: Dockerfile + docker-compose.yml + Makefile for containerized builds (make test, make clippy, make ci).
  • CI: GitHub Actions workflow with 4 parallel jobs — clippy, rustfmt, test, and Miri.
  • Pre-commit hook: Tracked in .githooks/, auto-configured on first make invocation — no tools to install.

Test plan

  • make ci passes (clippy clean, fmt clean, 18 tests pass)
  • No unsafe in src/
  • Miri — will run in CI on first push
  • Fuzz — make fuzz for local 10-min run

hasanzakeri and others added 2 commits March 11, 2026 18:41
  Replace plain stores on read_pos with compare_exchange_weak in both
  push and pop to prevent the cursor from moving backwards when producer
  and consumer race on overwrites.

  Add Docker-based dev workflow (Dockerfile, docker-compose.yml,
  Makefile), GitHub Actions CI (clippy, fmt, test, miri), and git
  pre-commit hook that auto-activates via Makefile.
@hasanzakeri
hasanzakeri merged commit 775d3fc into main Mar 12, 2026
4 checks passed
@hasanzakeri
hasanzakeri deleted the fix/race-condition branch March 12, 2026 03:26
hasanzakeri added a commit that referenced this pull request Mar 12, 2026
@hasanzakeri
hasanzakeri restored the fix/race-condition branch March 12, 2026 03:29
@hasanzakeri
hasanzakeri deleted the fix/race-condition branch March 12, 2026 03:33
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