Skip to content

fix(dataset): make mmap conversation reads concurrency-safe - #37

Merged
cquil11 merged 1 commit into
mainfrom
cquil11/fix-concurrent-mmap-reads
Aug 7, 2026
Merged

fix(dataset): make mmap conversation reads concurrency-safe#37
cquil11 merged 1 commit into
mainfrom
cquil11/fix-concurrent-mmap-reads

Conversation

@cquil11

@cquil11 cquil11 commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • read conversation records through cursor-free mmap slices
  • prevent parallel worker threads from racing a shared mmap cursor
  • add deterministic concurrent-read regression coverage

Root cause

MemoryMapDatasetClient.get_conversation() used seek() followed by read() on one mmap object shared by executor threads. Parallel AgentX warmup reads could move the shared cursor between those calls, returning the wrong or truncated JSON record.

Validation

  • uv run pytest tests/unit/dataset/test_payload_mmap.py tests/unit/dataset/test_memory_map_compress.py tests/unit/dataset/test_mmap_cache.py -q (94 passed)
  • full unit suite completed locally
  • pre-commit run --files src/aiperf/dataset/memory_map_utils.py tests/unit/dataset/test_payload_mmap.py

Signed-off-by: Cam Quilici <cjquilici@gmail.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@67a42758b366589951cdecc06087e0a6cf88603d

Recommended with virtual environment (using uv):

uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@67a42758b366589951cdecc06087e0a6cf88603d

Last updated for commit: 67a4275Browse code

@cquil11
cquil11 merged commit bcfc235 into main Aug 7, 2026
6 of 10 checks passed
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