Skip to content

Fix concurrent candle buffer reads - #617

Merged
saleh-mir merged 1 commit into
masterfrom
fix/dynamic-array-append-race
Aug 19, 2026
Merged

saleh-mir merged 1 commit into
masterfrom
fix/dynamic-array-append-race

Conversation

@saleh-mir

Copy link
Copy Markdown
Member

Summary

  • publish each DynamicNumpyArray buffer and logical index as one atomic state
  • prepare appended rows and capacity before exposing them to concurrent readers
  • use consistent snapshots for candle-service reads that need both the buffer and index
  • apply the same behavior to single-row appends, batch appends, drops, flushes, and deletes

This prevents live readers from addressing a row that the underlying NumPy buffer has not allocated yet, and prevents drop operations from exposing mismatched array/index generations.

Verification

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/test_dynamic_numpy_array.py tests/test_candle_service.py -q — 18 passed
  • deterministic concurrent growth-boundary harness for both append() and append_multiple()
  • concurrency stress harnesses with 20,000 appends and four readers, including drop_at configurations
  • python -m compileall -q jesse/libs/dynamic_numpy_array/__init__.py jesse/services/candle_service.py
  • git diff --check

Notes

The local pytest environment has an incompatible auto-loaded anyio plugin (_pytest.scope is unavailable), so the focused suite was run with third-party plugin autoload disabled.

@saleh-mir
saleh-mir merged commit 358599d into master Aug 19, 2026
15 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