Skip to content

feat(ondemand): protect object iteration via state-based container locking - #2809

Open
Pastoray wants to merge 1 commit into
simdjson:masterfrom
Pastoray:feat-ondemand-container-locking
Open

feat(ondemand): protect object iteration via state-based container locking#2809
Pastoray wants to merge 1 commit into
simdjson:masterfrom
Pastoray:feat-ondemand-container-locking

Conversation

@Pastoray

@Pastoray Pastoray commented Aug 5, 2026

Copy link
Copy Markdown

Short title (summary):
protect object iteration safety via container state locking

Description
I introduced an internal locked state flag to ondemand::object that is managed dynamically by object_iterator using RAII under SIMDJSON_DEVELOPMENT_CHECKS.

Related issue: #2314

Type of change

  • Bug fix
  • Optimization
  • New feature
  • Refactor / cleanup
  • Documentation / tests
  • Other (please describe):

How to verify / test
Added mid-loop reentrancy unit tests inside tests/ondemand/ondemand_object_error_tests.cpp. These tests explicitly confirm that invoking operator[], find_field(), or reset() inside an active object loop block safely returns OUT_OF_ORDER_ITERATION.

Checklist before submitting

  • I added/updated tests covering my change (if applicable)
  • Code builds locally and passes my check
  • Documentation / README updated if needed
  • Commits are atomic and messages are clear
  • I linked the related issue (if applicable)

Note for Reviewers: This is an intentional Part 1 initial commit that strictly applies the container-locking validation design to ondemand::object. I am purposely leaving out ondemand::array and other relevant container classes for now to gather early feedback on this baseline architectural pattern. Once you approve this locking model, I will proceed with applying the identical copy-paste pattern to the remaining containers.

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