Backport no-inspect NameError logic#8538
Conversation
Configure with -Xinspect.nameError.object=true|false. It defaults to true in JRuby 9.4.10.0 and false in JRuby 10. Fixes jruby#8538
818fbc6 to
17f8214
Compare
Configure with -Xinspect.nameError.object=true|false. It defaults to true in JRuby 9.4.10.0 and false in JRuby 10. Fixes jruby#8384
17f8214 to
2d13784
Compare
I realized that when I reproduced this it was Java 21 BUT also it was JRuby 10. I also cannot reproduce with Java 21 on 9.4. If I had to guess my TC refactoring for inspect() "fixed" it. |
|
Ok I think it's just that 21 is a bit more memory efficient, so it's able to handle this case in 250MB. I lowered it to 225MB and it fails like Java 8. Good to merge for 9.4.10. |
This is a backport of the no-inspect NameError logic added to JRuby 10 in #8533, guarded by an option for users on JRuby 9.4.
On 9.4, the inspect logic is enabled by default, but can be disabled by with the option
-XnameError.inspect.object=false. Because the object inspect is a specified behavior of Ruby 3.1, we can't disable it by default, but this allows users to opt out of the behavior.JRuby 10 will ignore this logic and avoid inspecting the object attached to the NameError. The option will have no effect.
Using the example from #8384 with this new option:
Interestingly, I discovered that the original code does not OOM on Java 21, because it never seems to call the expected inspect method. I will open an issue to investigate that.