From 2a951f62e117549a3e442925886859264fe809e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Barri=C3=A9?= Date: Fri, 23 May 2025 15:58:05 +0200 Subject: [PATCH] Change test to avoid stack overflow with MN threads When using MN threads (such as running the test in a ractor), this test failed because it was raising a SystemStackError: stack level too deep. This is because the machine stack is smaller under MN threads than on the native main thread. --- test/ruby/test_hash.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 7b8cf1c6c4..dbf041a732 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -2138,7 +2138,9 @@ class TestHashOnly < Test::Unit::TestCase def test_iterlevel_in_ivar_bug19589 h = { a: nil } - hash_iter_recursion(h, 200) + # Recursion level should be over 127 to actually test iterlevel being set in an instance variable, + # but it should be under 131 not to overflow the stack under MN threads/ractors. + hash_iter_recursion(h, 130) assert true end