From: test35965@...
Date: 2021-02-09T21:23:59+00:00
Subject: [ruby-core:102428] [Ruby master Bug#17612] ractor crash with some	simple codes

Issue #17612 has been updated by test35965@gmail.com (Alexander Riccio).


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.
```


----------------------------------------
Bug #17612: ractor crash with some simple codes
https://bugs.ruby-lang.org/issues/17612#change-90303

* Author: tomanderson (Thomas Ender)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I found these codes will crash because of **Ractor** :

``` ruby
    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.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>