Skip to content

Require the current transaction owner for store operations - #57

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/transaction-owner-check
Open

Require the current transaction owner for store operations#57
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/transaction-owner-check

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Check Mutex#owned? instead of locked? before store operations. A second thread currently reads/writes a transaction it does not own and can change its abort flag.

Reproduction and verification

Hold a transaction in thread A, then call [], fetch, []=, delete, keys, key?, commit and abort from thread B. All must raise PStore::Error, and A must still commit its original value. Both thread_safe settings are covered using bounded queue synchronization.

  • External focused corpus: 18 verified on this isolated branch under rbenv Ruby 4.0.6.
  • Existing upstream RBENV_VERSION=4.0.6 rbenv exec rake test: 13 tests / 26 assertions, zero failures before and after.
  • All files and injected failures are confined to scratch storage; no production operations.
  • No repository tests added or modified under the contributor's task constraint. Other Ruby versions and native Windows were not executed locally.

Breaking-change notes and limitations

Cross-thread calls outside their own transaction now raise the documented not-in-transaction error. Legitimate owner access and serialized transaction calls remain supported.

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