Skip to content

Namespace Timeout Ractor storage internally - #122

Closed
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/internal-ractor-key
Closed

Namespace Timeout Ractor storage internally#122
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/internal-ractor-key

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Timeout currently stores its shared state under the public symbol :timeout_gem_state. Unrelated code can preclaim that key and break Timeout initialization. Use an internal Ractor storage key so public-key collisions cannot replace the state. The current suite passes 284 tests / 636 assertions in cumulative verification on Ruby 4.0.6 and 3.2.11; a bounded public-key preclaim model fails baseline in 5/5 runs and passes the candidate in 5/5. No repository tests were changed.

Comment thread lib/timeout.rb
# 2. Method object can be shareable (4.0~)
def self.instance
Ractor.store_if_absent :timeout_gem_state do
Ractor.store_if_absent :"\0timeout_gem_state" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really any more private.

@eregon

eregon commented Aug 30, 2026

Copy link
Copy Markdown
Member

@OskarEichler Please double-check yourself the usefulness of such PRs before submitting them, to avoid spamming maintainers.

@eregon eregon closed this Aug 30, 2026
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.

2 participants