-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Reflective methods should not create symbols for nonexistent elements #5169
Comments
We all agree that the hard symbol issue should be fixed for 9.2. The simple fix is to make them soft, and I mention above that although it would not leak it would temporarily pollute the symbol table with useless entries. However, the surface area for this case seems very small:
And the impact of this would be fairly limited: if it's a check to see if the reflective value has been set, so it can be initialized, it would almost immediately be made a proper hard identifier symbol. So for the 9.2 release I believe the risk is low in the soft symbol option. |
@enebo We should evaluate if this is still really an issue. Your work on symbols landed for 9.2, and the surface area for this bug remains small: you must be accessing non-existing identifiers using the Java-facing reflective methods like instance_variable_get. The dance that's a problem is the use of validateInstanceVariable, which always creates a symbol whether the variable exists or not. |
Currently our logic for reflective methods like Object#instance_variable_get, Struct#[], etc goes like this:
The logic we need to match in MRI is as follows:
MRI only creates symbols for nonexistent key strings passed to the write methods, like instance_variable_set. Our logic has the following issues that should be addressed in some way before 9.2 (or if possible, we should match MRI's logic exactly):
In general MRI will assume that if a string is passed in, and no such symbol exists, no such entry can exists in whatever is being searched.
The text was updated successfully, but these errors were encountered: