Skip to content

ObjectSpace._id2ref should not return unshareable #3878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

ko1
Copy link
Contributor

@ko1 ko1 commented Dec 10, 2020

ObjectSpace._id2ref(id) can return any objects even if they are
unshareable, so this patch raises RangeError if it runs on multi-ractor
mode and the found object is unshareable.

ObjectSpace._id2ref(id) can return any objects even if they are
unshareable, so this patch raises RangeError if it runs on multi-ractor
mode and the found object is unshareable.
@ko1 ko1 changed the title ObjectSpace._id2ref should not support unshareable ObjectSpace._id2ref should not return unshareable Dec 10, 2020
@ko1 ko1 merged commit 72f1c43 into ruby:master Dec 10, 2020
@marcandre
Copy link
Member

IIUC, starting any Ractor anywhere in the code makes this method no longer work (for most objects)?
This seems like big potential incompatibility.
Is it not better to warn in this case and assume that objects are requested from the correct Ractor?
Is the plan to remove this limitation when you can check which Ractor an object belongs to (I presume when memory allocation is per-ractor?)

@ko1
Copy link
Contributor Author

ko1 commented Dec 11, 2020

Yes, I hope 3.1 has per-ractor objectspace and this limitation will removed.

Now _id2ref is not recommended API ( https://bugs.ruby-lang.org/issues/15408 ) so I think it is no problem.
The biggest problem is finalizers...

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