Skip to content

Commit 2a951f6

Browse files
etiennebarriebyroot
authored andcommitted
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.
1 parent f64c89f commit 2a951f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/ruby/test_hash.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,9 @@ def hash_iter_recursion(h, level)
21382138

21392139
def test_iterlevel_in_ivar_bug19589
21402140
h = { a: nil }
2141-
hash_iter_recursion(h, 200)
2141+
# Recursion level should be over 127 to actually test iterlevel being set in an instance variable,
2142+
# but it should be under 131 not to overflow the stack under MN threads/ractors.
2143+
hash_iter_recursion(h, 130)
21422144
assert true
21432145
end
21442146

0 commit comments

Comments
 (0)