As shown on Ruby's issue tracker [1], the following is enough to reproduce Ruby's issue:
h = {a:1, b:2, c:3, d:4, e:5, f:6, g:7, h:8} h.each{|k,v| GC.start; h.delete(k)}
Saved in `test.rb` and launched via command line `ruby test.rb` this should crash with the following:
Traceback (most recent call last): 1: from test.rb:2:in `<main>' test.rb:2:in `each': ret: 2, hash modified during iteration (RuntimeError)
After patching Ruby I no longer experience a RuntimeError.
I could also provide a reproducer for sonic-pi crash, but it would have to be interactive, as sonic-pi in Ubuntu Focal does not yet have a CLI.
[1] https://bugs.ruby-lang.org/issues/16503
As shown on Ruby's issue tracker [1], the following is enough to reproduce Ruby's issue:
h = {a:1, b:2, c:3, d:4, e:5, f:6, g:7, h:8}
h.each{|k,v| GC.start; h.delete(k)}
Saved in `test.rb` and launched via command line `ruby test.rb` this should crash with the following:
Traceback (most recent call last):
1: from test.rb:2:in `<main>'
test.rb:2:in `each': ret: 2, hash modified during iteration (RuntimeError)
After patching Ruby I no longer experience a RuntimeError.
I could also provide a reproducer for sonic-pi crash, but it would have to be interactive, as sonic-pi in Ubuntu Focal does not yet have a CLI.
[1] https:/ /bugs.ruby- lang.org/ issues/ 16503