diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-02-10 15:24:23 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-02-10 19:44:47 +0900 |
commit | 3acc81d9e41b18380b9e0168fe2b5e5e0c727256 (patch) | |
tree | 0d68429ae285afae1b0e5a33bae2f317fb2e1b55 /bootstraptest | |
parent | ad2c7f8a1ea82d5b1913b466fcac63b77cb07569 (diff) |
Fixed race in dtoa [Bug #17612]
Fixed the race condition when replacing `freelist` entry with its
chained next element. At acquiring an entry, hold the entry once
with the special value, then release by replacing it with the next
element again after acquired. If another thread is holding the
same entry at that time, spinning until the entry gets released.
Co-Authored-By: Koichi Sasada <ko1@atdot.net>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4167
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_ractor.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index b32a79063b..f1c3197275 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -158,6 +158,17 @@ assert_equal '[[:e1, 1], [:e2, 2]]', %q{ a # } +# dtoa race condition +assert_equal '[:ok, :ok, :ok]', %q{ + n = 3 + n.times.map{ + Ractor.new{ + 10_000.times{ rand.to_s } + :ok + } + }.map(&:take) +} + ### ### # Ractor still has several memory corruption so skip huge number of tests |