Project

General

Profile

Actions

Bug #17612

closed

ractor crash with some simple codes

Added by tomanderson (Thomas Ender) about 3 years ago. Updated about 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:102416]

Description

I found these codes will crash because of Ractor :

    e = (1..1000).to_a
    arr = [e,e,e,e]

    arr.map { |sub_arr|
      Ractor.new(sub_arr) do |sub_arr|
        sub_arr.map {
          Digest::MD5.hexdigest(rand.to_s)
        }
      end
    }.map{|r| r.take}.reduce(:+)

If change e to (1..100), no crashes any more. If we don't use Ractor, it's also good.

Environment: ruby3.0.0p0 + rails6.1.1.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #17742: Random.rand gets wrong after using Ractor and requiring benchmarkClosedActions

Updated by ko1 (Koichi Sasada) about 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)

Could you give me an error log?

2.times.map{ Ractor.new{ loop{ rand.to_s } } }.each(&:take)

I can find an issue on the simpler example, but I also observed different error on the your original example.
I want to confirmed what error you got.

Updated by tomanderson (Thomas Ender) about 3 years ago

@ko1 (Koichi Sasada) Here is my error log when running your simpler code:

irb(main):036:0> 2.times.map{ Ractor.new{ loop{ rand.to_s } } }.each(&:take)
internal:ractor:267: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
*** Error in `irb': free(): invalid next size (fast): 0x00007f69a0001490 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f69aaea37f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7f69aaeac38a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f69aaeb058c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_sized_xfree+0x41)[0x7f69ab2df621]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x165c2a)[0x7f69ab35bc2a]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e)[0x7f69ab47a57e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c)[0x7f69ab47e86c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x29008e)[0x7f69ab48608e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_exec+0xc8)[0x7f69ab48bc38]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x2a0cc7)[0x7f69ab496cc7]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vrescue2+0x10a)[0x7f69ab2c561a]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_rescue2+0x8a)[0x7f69ab2c589a]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e)[0x7f69ab47a57e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x298d31)[0x7f69ab48ed31]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x2993b3)[0x7f69ab48f3b3]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c)[0x7f69ab47e86c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x290a5a)[0x7f69ab486a5a]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_exec+0xc8)[0x7f69ab48bc38]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x24f735)[0x7f69ab445735]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x2516f4)[0x7f69ab4476f4]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x251a26)[0x7f69ab447a26]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f69aa9fc6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f69aaf334dd]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
00600000-00601000 r--p 00000000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
00601000-00602000 rw-p 00001000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
023d4000-02e21000 rw-p 00000000 00:00 0 [heap]
7f6998000000-7f6998021000 rw-p 00000000 00:00 0
7f6998021000-7f699c000000 ---p 00000000 00:00 0
7f699c000000-7f699c021000 rw-p 00000000 00:00 0
7f699c021000-7f69a0000000 ---p 00000000 00:00 0
7f69a0000000-7f69a0021000 rw-p 00000000 00:00 0
7f69a0021000-7f69a4000000 ---p 00000000 00:00 0
7f69a5563000-7f69a557a000 r-xp 00000000 08:01 11141258 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f69a557a000-7f69a5779000 ---p 00017000 08:01 11141258 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f69a5779000-7f69a577a000 r--p 00016000 08:01 11141258 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f69a577a000-7f69a577b000 rw-p 00017000 08:01 11141258 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f69a577b000-7f69a577c000 ---p 00000000 00:00 0
7f69a577c000-7f69a597c000 rw-p 00000000 00:00 0
7f69a597c000-7f69a597d000 ---p 00000000 00:00 0
7f69a597d000-7f69a5b7d000 rw-p 00000000 00:00 0
7f69a5b7d000-7f69a5b83000 r-xp 00000000 08:01 6573663 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/etc.so
7f69a5b83000-7f69a5d82000 ---p 00006000 08:01 6573663 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/etc.so
7f69a5d82000-7f69a5d83000 r--p 00005000 08:01 6573663 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/etc.so
7f69a5d83000-7f69a5d84000 rw-p 00006000 08:01 6573663 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/etc.so
7f69a5d84000-7f69a5d8b000 r-xp 00000000 08:01 6573529 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/io/console.so
7f69a5d8b000-7f69a5f8a000 ---p 00007000 08:01 6573529 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/io/console.so
7f69a5f8a000-7f69a5f8b000 r--p 00006000 08:01 6573529 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/io/console.so
7f69a5f8b000-7f69a5f8c000 rw-p 00007000 08:01 6573529 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/io/console.so
7f69a5f8c000-7f69a5fc7000 r-xp 00000000 08:01 6573566 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/ripper.so
7f69a5fc7000-7f69a61c7000 ---p 0003b000 08:01 6573566 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/ripper.so
7f69a61c7000-7f69a61c9000 r--p 0003b000 08:01 6573566 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/ripper.so
7f69a61c9000-7f69a61ca000 rw-p 0003d000 08:01 6573566 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/ripper.so
7f69a61ca000-7f69a61cc000 r-xp 00000000 08:01 6573544 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/monitor.so
7f69a61cc000-7f69a63cb000 ---p 00002000 08:01 6573544 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/monitor.so
7f69a63cb000-7f69a63cc000 r--p 00001000 08:01 6573544 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/monitor.so
7f69a63cc000-7f69a63cd000 rw-p 00002000 08:01 6573544 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/monitor.so
7f69a63cd000-7f69a63d0000 r-xp 00000000 08:01 6573635 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7f69a63d0000-7f69a65cf000 ---p 00003000 08:01 6573635 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7f69a65cf000-7f69a65d0000 r--p 00002000 08:01 6573635 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7f69a65d0000-7f69a65d1000 rw-p 00003000 08:01 6573635 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7f69a65d1000-7f69a65d3000 r-xp 00000000 08:01 6573589 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f69a65d3000-7f69a67d2000 ---p 00002000 08:01 6573589 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f69a67d2000-7f69a67d3000 r--p 00001000 08:01 6573589 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f69a67d3000-7f69a67d4000 rw-p 00002000 08:01 6573589 /home/thomas/.rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f69a67d4000-7f69a67d5000 ---p 00000000 00:00 0
7f69a67d5000-7f69a6876000 rw-p 00000000 00:00 0
7f69a6876000-7f69a6877000 ---p 00000000 00:00 0
7f69a6877000-7f69a6918000 rw-p 00000000 00:00 0
7f69a6918000-7f69a6919000 ---p 00000000 00:00 0
7f69a6919000-7f69a69ba000 rw-p 00000000 00:00 0
7f69a69ba000-7f69a69bb000 ---p 00000000 00:00 0
7f69a69bb000-7f69a6a5c000 rw-p 00000000 00:00 0
7f69a6a5c000-7f69a6a5d000 ---p 00000000 00:00 0
7f69a6a5d000-7f69a6afe000 rw-p 00000000 00:00 0
7f69a6afe000-7f69a6aff000 ---p 00000000 00:00 0
7f69a6aff000-7f69a6ba0000 rw-p 00000000 00:00 0
7f69a6ba0000-7f69a6ba1000 ---p 00000000 00:00 0
7f69a6ba1000-7f69a6c42000 rw-p 00000000 00:00 0
7f69a6c42000-7f69a6c43000 ---p 00000000 00:00 0
7f69a6c43000-7f69a6ce4000 rw-p 00000000 00:00 0
7f69a6ce4000-7f69a6ce5000 ---p 00000000 00:00 0
7f69a6ce5000-7f69a6d86000 rw-p 00000000 00:00 0
7f69a6d86000-7f69a6d87000 ---p 00000000 00:00 0
7f69a6d87000-7f69a6e28000 rw-p 00000000 00:00 0
7f69a6e28000-7f69a6e29000 ---p 00000000 00:00 0
7f69a6e29000-7f69a6eca000 rw-p 00000000 00:00 0
7f69a6eca000-7f69a6ecb000 ---p 00000000 00:00 0
7f69a6ecb000-7f69a6f6c000 rw-p 00000000 00:00 0
7f69a6f6c000-7f69a6f6d000 ---p 00000000 00:00 0
7f69a6f6d000-7f69a700e000 rw-p 00000000 00:00 0
7f69a700e000-7f69a700f000 ---p 00000000 00:00 0
7f69a700f000-7f69a70b0000 rw-p 00000000 00:00 0
7f69a70b0000-7f69a70b1000 ---p 00000000 00:00 0
7f69a70b1000-7f69a7152000 rw-p 00000000 00:00 0
7f69a7152000-7f69a7153000 ---p 00000000 00:00 0
7f69a7153000-7f69a71f4000 rw-p 00000000 00:00 0
7f69a71f4000-7f69a71f5000 ---p 00000000 00:00 0
7f69a71f5000-7f69a7296000 rw-p 00000000 00:00 0
7f69a7296000-7f69a7297000 ---p 00000000 00:00 0
7f69a7297000-7f69a7338000 rw-p 00000000 00:00 0
7f69a7338000-7f69a7339000 ---p 00000000 00:00 0
7f69a7339000-7f69a73da000 rw-p 00000000 00:00 0
7f69a73da000-7f69a73db000 ---p 00000000 00:00 0
7f69a73db000-7f69a747c000 rw-p 00000000 00:00 0
7f69a747c000-7f69a747d000 ---p 00000000 00:00 0
7f69a747d000-7f69a751e000 rw-p 00000000 00:00 0
7f69a751e000-7f69a751f000 ---p 00000000 00:00 0
7f69a751f000-7f69a75c0000 rw-p 00000000 00:00 0
7f69a75c0000-7f69a75c1000 ---p 00000000 00:00 0
7f69a75c1000-7f69a7662000 rw-p 00000000 00:00 0
7f69a7662000-7f69a7663000 ---p 00000000 00:00 0
7f69a7663000-7f69a7704000 rw-p 00000000 00:00 0
7f69a7704000-7f69a7705000 ---p 00000000 00:00 0
7f69a7705000-7f69a77a6000 rw-p 00000000 00:00 0
7f69a77a6000-7f69a77a7000 ---p 00000000 00:00 0
7f69a77a7000-7f69a7848000 rw-p 00000000 00:00 0
7f69a7848000-7f69a7849000 ---p 00000000 00:00 0
7f69a7849000-7f69a78ea000 rw-p 00000000 00:00 0
7f69a78ea000-7f69a78eb000 ---p 00000000 00:00 0
7f69a78eb000-7f69a798c000 rw-p 00000000 00:00 0
7f69a798c000-7f69a798d000 ---p 00000000 00:00 0
7f69a798d000-7f69a7a2e000 rw-p 00000000 00:00 0
7f69a7a2e000-7f69a7a2f000 ---p 00000000 00:00 0
7f69a7a2f000-7f69a7ad0000 rw-p 00000000 00:00 0
7f69a7ad0000-7f69a7ad1000 ---p 00000000 00:00 0
7f69a7ad1000-7f69a7b72000 rw-p 00000000 00:00 0
7f69a7b72000-7f69a7b73000 ---p 00000000 00:00 0
7f69a7b73000-7f69a9c1d000 rw-p 00000000 00:00 0
7f69a9c1d000-7f69aa0a8000 r--p 00000000 08:01 5374958 /usr/lib/locale/locale-archive
7f69aa0a8000-7f69aa1b0000 r-xp 00000000 08:01 11152156 /lib/x86_64-linux-gnu/libm-2.23.so
7f69aa1b0000-7f69aa3af000 ---p 00108000 08:01 11152156 /lib/x86_64-linux-gnu/libm-2.23.so
7f69aa3af000-7f69aa3b0000 r--p 00107000 08:01 11152156 /lib/x86_64-linux-gnu/libm-2.23.so
7f69aa3b0000-7f69aa3b1000 rw-p 00108000 08:01 11152156 /lib/x86_64-linux-gnu/libm-2.23.so
7f69aa3b1000-7f69aa3ba000 r-xp 00000000 08:01 11152158 /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f69aa3ba000-7f69aa5b9000 ---p 00009000 08:01 11152158 /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f69aa5b9000-7f69aa5ba000 r--p 00008000 08:01 11152158 /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f69aa5ba000-7f69aa5bb000 rw-p 00009000 08:01 11152158 /lib/x86_64-linux-gnu/libcrypt-2.23.so
7f69aa5bb000-7f69aa5e9000 rw-p 00000000 00:00 0
7f69aa5e9000-7f69aa5ec000 r-xp 00000000 08:01 11142968 /lib/x86_64-linux-gnu/libdl-2.23.so
7f69aa5ec000-7f69aa7eb000 ---p 00003000 08:01 11142968 /lib/x86_64-linux-gnu/libdl-2.23.so
7f69aa7eb000-7f69aa7ec000 r--p 00002000 08:01 11142968 /lib/x86_64-linux-gnu/libdl-2.23.so
7f69aa7ec000-7f69aa7ed000 rw-p 00003000 08:01 11142968 /lib/x86_64-linux-gnu/libdl-2.23.so
7f69aa7ed000-7f69aa7f4000 r-xp 00000000 08:01 11152172 /lib/x86_64-linux-gnu/librt-2.23.so
7f69aa7f4000-7f69aa9f3000 ---p 00007000 08:01 11152172 /lib/x86_64-linux-gnu/librt-2.23.so
7f69aa9f3000-7f69aa9f4000 r--p 00006000 08:01 11152172 /lib/x86_64-linux-gnu/librt-2.23.so
7f69aa9f4000-7f69aa9f5000 rw-p 00007000 08:01 11152172 /lib/x86_64-linux-gnu/librt-2.23.so
7f69aa9f5000-7f69aaa0d000 r-xp 00000000 08:01 11152153 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f69aaa0d000-7f69aac0c000 ---p 00018000 08:01 11152153 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f69aac0c000-7f69aac0d000 r--p 00017000 08:01 11152153 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f69aac0d000-7f69aac0e000 rw-p 00018000 08:01 11152153 /lib/x86_64-linux-gnu/libpthread-2.23.so
7f69aac0e000-7f69aac12000 rw-p 00000000 00:00 0
7f69aac12000-7f69aac2b000 r-xp 00000000 08:01 11143060 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f69aac2b000-7f69aae2a000 ---p 00019000 08:01 11143060 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f69aae2a000-7f69aae2b000 r--p 00018000 08:01 11143060 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f69aae2b000-7f69aae2c000 rw-p 00019000 08:01 11143060 /lib/x86_64-linux-gnu/libz.so.1.2.8
7f69aae2c000-7f69aafec000 r-xp 00000000 08:01 11152152 /lib/x86_64-linux-gnu/libc-2.23.so
7f69aafec000-7f69ab1ec000 ---p 001c0000 08:01 11152152 /lib/x86_64-linux-gnu/libc-2.23.so
7f69ab1ec000-7f69ab1f0000 r--p 001c0000 08:01 11152152 /lib/x86_64-linux-gnu/libc-2.23.so
7f69ab1f0000-7f69ab1f2000 rw-p 001c4000 08:01 11152152 /lib/x86_64-linux-gnu/libc-2.23.so
7f69ab1f2000-7f69ab1f6000 rw-p 00000000 00:00 0
7f69ab1f6000-7f69ab5b1000 r-xp 00000000 08:01 6563406 /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f69ab5b1000-7f69ab7b0000 ---p 003bb000 08:01 6563406 /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f69ab7b0000-7f69ab7b7000 r--p 003ba000 08:01 6563406 /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f69ab7b7000-7f69ab7ba000 rw-p 003c1000 08:01 6563406 /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f69ab7ba000-7f69ab7cb000 rw-p 00000000 00:00 0
7f69ab7cb000-7f69ab7f1000 r-xp 00000000 08:01 11152163 /lib/x86_64-linux-gnu/ld-2.23.so
7f69ab865000-7f69ab9cc000 rw-p 00000000 00:00 0
7f69ab9e7000-7f69ab9e8000 rw-p 00000000 00:00 0
7f69ab9e8000-7f69ab9ef000 r--s 00000000 08:01 5508188 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f69ab9ef000-7f69ab9f0000 rw-p 00000000 00:00 0
7f69ab9f0000-7f69ab9f1000 r--p 00025000 08:01 11152163 /lib/x86_64-linux-gnu/ld-2.23.so
7f69ab9f1000-7f69ab9f2000 rw-p 00026000 08:01 11152163 /lib/x86_64-linux-gnu/ld-2.23.so
7f69ab9f2000-7f69ab9f3000 rw-p 00000000 00:00 0
7ffdf24f5000-7ffdf2cf4000 rw-p 00000000 00:00 0 [stack]
7ffdf2d9e000-7ffdf2da1000 r--p 00000000 00:00 0 [vvar]
7ffdf2da1000-7ffdf2da3000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

And here's for my original example:

*** Error in ruby': free(): invalid next size (fast): 0x00007fb9e40032a0 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7fb9ff9847f5] /lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7fb9ff98d38a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb9ff99158c] /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_sized_xfree+0x41)[0x7fb9ffdc0621] /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x165c2a)[0x7fb9ffe3cc2a] /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e)[0x7fb9fff5b57e] /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c)[0x7fb9fff5f86c] /home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x29008e)[0x7fb9fff6708e] *** Error in ruby': free(): invalid next size (fast): 0x00007fb9f00032a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7fb9ff98d38a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb9ff99158c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_sized_xfree+0x41)[0x7fb9ffdc0621]
(rb_vm_exec/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x165c2a)[0x7fb9ffe3cc2a]
+0x/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e)[0x7fb9fff5b57e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c)[0x7fb9fff5f86c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x29008e)[0x7fb9fff6708e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_exec+0xc8)[0x7fb9fff6cc38]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_yield+0x18e)[0x7fb9fff6f06e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x4017f)[0x7fb9ffd1717f]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e)[0x7fb9fff5b57e]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c)[0x7fb9fff5f86c]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x290a5a)[0x7fb9fff67a5a]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_exec+0xc8)[0x7fb9fff6cc38]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x24f735)[0x7fb9fff26735]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x2516f4)[0x7fb9fff286f4]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x251a26)[0x7fb9fff28a26]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fb9ff4dd6ba]
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x4017f)[0x7fb9ffd1717f]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb9ffa144dd]
======= Memory map: ========
/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28457e00400000-00401000 r-xp 00000000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
00600000-00601000 r--p 00000000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
00601000-00602000 rw-p 00001000 08:01 6563405 /home/thomas/.rbenv/versions/3.0.0/bin/ruby
02471000-02808000 rw-p 00000000 00:00 0 [heap]
7fb9e4000000-7fb9e4021000 rw-p 00000000 00:00 0
7fb9e4021000-7fb9e8000000 ---p 00000000 00:00 0
7fb9e8000000-7fb9e8021000 rw-p 00000000 00:00 0
7fb9e8021000-7fb9ec000000 ---p 00000000 00:00 0
7fb9ec000000-7fb9ec021000 rw-p 00000000 00:00 0
7fb9ec021000-7fb9f0000000 ---p 00000000 00:00 0
7fb9f0000000-7fb9f0021000 rw-p 00000000 00:00 0
7fb9f0021000-7fb9f4000000 ---p 00000000 00:00 0
7fb9f4000000-7fb9f4021000 rw-p 00000000 00:00 0
7fb9f4021000-7fb9f8000000 ---p 00000000 00:00 0
7fb9f9e87000-7fb9f9e9e000 r-xp 00000000 08:01 11141258 /lib/x86_64-linux-gnu/libgcc_s/home/thomas/.rbenv/versions/3.0.0/lib/libruby.so.3.0(+0x28886c已放弃 (核心已转储)

FYI, my environment is ruby 3.0.0 installed by rbenv, OS is ubuntu 16.04 desktop x64. My example was firstly found crashed in Rails, but later I put it into .rb and run script with ruby, it crashed in the same way. I also test it on windows 10 with ruby 3.0 installed by rubyinstaller.org version and seems to be the same.

Updated by test35965@gmail.com (Alexander Riccio) about 3 years ago

While I don't have access to a build of ruby with debug symbols (and nmake DOES NOT like spaces in usernames), I have been able to reproduce a crash with Application Verifier enabled with heaps checks. It triggers an access violation seemingly way before, so I suspect there's heap corruption that only shows up when the block is later freed.

Here's the stacktrace on access violation with the simpler example:

 # Child-SP          RetAddr           Call Site
00 00000000`3a0aed60 00000000`63a7fc61 x64_msvcrt_ruby300!ruby_dtoa+0xda5
01 00000000`3a0aee50 00000000`63baef19 x64_msvcrt_ruby300!rb_float_equal+0x251
02 00000000`3a0aef00 00000000`63bc5c35 x64_msvcrt_ruby300!rb_error_arity+0x269
03 00000000`3a0af000 00000000`63bb9f07 x64_msvcrt_ruby300!rb_add_method+0x205
04 00000000`3a0af150 00000000`63bbcf92 x64_msvcrt_ruby300!rb_vm_exec+0x237
05 00000000`3a0af3a0 00000000`639e84a9 x64_msvcrt_ruby300!rb_vm_invoke_bmethod+0x1e62
06 00000000`3a0af450 00000000`639e872a x64_msvcrt_ruby300!rb_vrescue2+0x179
07 00000000`3a0af600 00000000`63ba8a52 x64_msvcrt_ruby300!rb_rescue2+0x2a
08 00000000`3a0af650 00000000`63baef19 x64_msvcrt_ruby300!rb_f_notimplement+0xe52
09 00000000`3a0af690 00000000`63bb1ff7 x64_msvcrt_ruby300!rb_error_arity+0x269
0a 00000000`3a0af790 00000000`63bc5c8d x64_msvcrt_ruby300!rb_eql_opt+0xe7
0b 00000000`3a0af830 00000000`63bb9f07 x64_msvcrt_ruby300!rb_add_method+0x25d
0c 00000000`3a0af980 00000000`63b7486c x64_msvcrt_ruby300!rb_vm_exec+0x237
0d 00000000`3a0afbd0 00000000`63b74d03 x64_msvcrt_ruby300!rb_vm_proc_local_ep+0x3dc
0e 00000000`3a0afcb0 00000000`63b75365 x64_msvcrt_ruby300!rb_vm_proc_local_ep+0x873
0f 00000000`3a1afe60 00007ff8`2cf46a74 x64_msvcrt_ruby300!rb_vm_proc_local_ep+0xed5
10 00000000`3a1afef0 00007ff8`55c57034 vfbasics!AVrfpStandardThreadFunction+0x44
11 00000000`3a1aff30 00007ff8`57bfd0d1 KERNEL32!BaseThreadInitThunk+0x14
12 00000000`3a1aff60 00000000`00000000 ntdll!RtlUserThreadStart+0x21


If there's a ruby build with debug symbols or ASAN, this should be pretty easy to scope out.
Actions #4

Updated by nobu (Nobuyoshi Nakada) about 3 years ago

  • Status changed from Assigned to Closed

Applied in changeset git|3acc81d9e41b18380b9e0168fe2b5e5e0c727256.


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

Actions #5

Updated by ko1 (Koichi Sasada) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED

Updated by naruse (Yui NARUSE) about 3 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: DONE

ruby_3_0 6bf32cbed8f3fd0b73b99737d671f833c594d800 merged revision(s) 63abb5c227e5c20d18d0debf699251da93ca64b5,34d02631e71209b12abb69d0114601027e485bc9,2adbf01ae14c0a4cf190b7c969b91726966a0e0f,3acc81d9e41b18380b9e0168fe2b5e5e0c727256.

Actions #7

Updated by wanabe (_ wanabe) about 3 years ago

  • Related to Bug #17742: Random.rand gets wrong after using Ractor and requiring benchmark added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0