mirror of
https://github.com/rubyjs/mini_racer
synced 2023-03-27 23:21:28 -04:00
DEV: test_concurrent_access causing segfaults
In Ruby <=2.7, SecureRandom.hex lazily defined `gen_random'. While the method definition itself was protected by a mutex, another thread calling `gen_random' did not take the mutex so it would attempt to call the method while another method was still defining it. Ruby 3.0+ has commit 475c8701d74ebebe (Make SecureRandom support Ractor, 2020-09-04) which also made it thread-safe in addition to being Ractor-safe.
This commit is contained in:
parent
81f30046d7
commit
feb8dc4cbf
1 changed files with 4 additions and 0 deletions
|
@ -583,6 +583,10 @@ raise FooError, "I like foos"
|
|||
|
||||
equals_after_sleep = {}
|
||||
|
||||
# workaround Rubies prior to commit 475c8701d74ebebe
|
||||
# (Make SecureRandom support Ractor, 2020-09-04)
|
||||
SecureRandom.hex
|
||||
|
||||
(1..10).map do |i|
|
||||
Thread.new {
|
||||
random = SecureRandom.hex
|
||||
|
|
Loading…
Add table
Reference in a new issue