[#107430] [Ruby master Feature#18566] Merge `io-wait` gem into core IO — "byroot (Jean Boussier)" <noreply@...>

Issue #18566 has been reported by byroot (Jean Boussier).

22 messages 2022/02/02

[#107434] [Ruby master Bug#18567] Depending on default gems when not needed considered harmful — "Eregon (Benoit Daloze)" <noreply@...>

Issue #18567 has been reported by Eregon (Benoit Daloze).

31 messages 2022/02/02

[#107443] [Ruby master Feature#18568] Explore lazy RubyGems boot to reduce need for --disable-gems — "headius (Charles Nutter)" <noreply@...>

Issue #18568 has been reported by headius (Charles Nutter).

13 messages 2022/02/02

[#107481] [Ruby master Feature#18571] Removed the bundled sources from release package after Ruby 3.2 — "hsbt (Hiroshi SHIBATA)" <noreply@...>

Issue #18571 has been reported by hsbt (Hiroshi SHIBATA).

9 messages 2022/02/04

[#107490] [Ruby master Bug#18572] Performance regression when invoking refined methods — "palkan (Vladimir Dementyev)" <noreply@...>

Issue #18572 has been reported by palkan (Vladimir Dementyev).

12 messages 2022/02/05

[#107514] [Ruby master Feature#18576] Rename `ASCII-8BIT` encoding to `BINARY` — "byroot (Jean Boussier)" <noreply@...>

Issue #18576 has been reported by byroot (Jean Boussier).

47 messages 2022/02/08

[#107536] [Ruby master Feature#18579] Concatenation of ASCII-8BIT strings shouldn't behave differently depending on string contents — "tenderlovemaking (Aaron Patterson)" <noreply@...>

Issue #18579 has been reported by tenderlovemaking (Aaron Patterson).

11 messages 2022/02/09

[#107547] [Ruby master Bug#18580] Range#include? inconsistency for String ranges — "zverok (Victor Shepelev)" <noreply@...>

Issue #18580 has been reported by zverok (Victor Shepelev).

10 messages 2022/02/10

[#107603] [Ruby master Feature#18589] Finer-grained constant invalidation — "kddeisz (Kevin Newton)" <noreply@...>

Issue #18589 has been reported by kddeisz (Kevin Newton).

17 messages 2022/02/16

[#107624] [Ruby master Bug#18590] String#downcase and CAPITAL LETTER I WITH DOT ABOVE — "andrykonchin (Andrew Konchin)" <noreply@...>

Issue #18590 has been reported by andrykonchin (Andrew Konchin).

13 messages 2022/02/17

[#107651] [Ruby master Misc#18591] DevMeeting-2022-03-17 — "mame (Yusuke Endoh)" <noreply@...>

Issue #18591 has been reported by mame (Yusuke Endoh).

11 messages 2022/02/18

[#107682] [Ruby master Feature#18595] Alias `String#-@` as `String#dedup` — "byroot (Jean Boussier)" <noreply@...>

Issue #18595 has been reported by byroot (Jean Boussier).

15 messages 2022/02/21

[#107699] [Ruby master Feature#18597] Strings need a named method like `dup` that doesn't duplicate if receiver is mutable — "danh337 (Dan H)" <noreply@...>

Issue #18597 has been reported by danh337 (Dan H).

18 messages 2022/02/21

[ruby-core:107597] [Ruby master Bug#18586] ObjectSpace::WeakMap#each seems to leak a broken object

From: "mame (Yusuke Endoh)" <noreply@...>
Date: 2022-02-15 17:20:38 UTC
List: ruby-core #107597
Issue #18586 has been reported by mame (Yusuke Endoh).

----------------------------------------
Bug #18586: ObjectSpace::WeakMap#each seems to leak a broken object
https://bugs.ruby-lang.org/issues/18586

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
```
h = ObjectSpace::WeakMap.new

GC.disable

s = "a"
10000.times do
  h[s] = true
  s = s.succ
end

GC.enable

h.each do |x|
  x + ""
  x + ""
  x + ""
end
```

```
$ ruby t.rb
t.rb:15: [BUG] Segmentation fault at 0x0000000000000028
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0004 p:0013 s:0018 e:000015 BLOCK  t.rb:15 [FINISH]
c:0003 p:---- s:0012 e:000011 CFUNC  :each
c:0002 p:0056 s:0008 E:0012f0 EVAL   t.rb:13 [FINISH]
c:0001 p:0000 s:0003 E:001060 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
t.rb:13:in `<main>'
t.rb:13:in `each'
t.rb:15:in `block in <main>'

-- Machine register context ------------------------------------------------
 RIP: 0x00005638b271ab52 RBP: 0x00007fc17ab30c20 RSP: 0x00007ffc5f4e4b90
 RAX: 0x0000000000000001 RBX: 0x0000000000000000 RCX: 0x00005638b293a840
 RDX: 0x00007fc17ab30c20 RDI: 0x0000002b00100003 RSI: 0x00007fc17ab30c20
  R8: 0x00005638b330bbc0  R9: 0x0000000000000002 R10: 0x00007fc17e06b278
 R11: 0x00007fc17ab462f0 R12: 0x0000002b00100003 R13: 0x00005638b330b9b0
 R14: 0x00005638b34cf6f8 R15: 0x000000000000002b EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/home/mame/local/bin/ruby(rb_vm_bugreport+0x570) [0x5638b2741820]
/home/mame/local/bin/ruby(rb_bug_for_fatal_signal+0xec) [0x5638b280bafc]
/home/mame/local/bin/ruby(sigsegv+0x4d) [0x5638b26930cd]
[0x7fc17e867520]
/home/mame/local/bin/ruby(rb_vm_search_method_slowpath+0x52) [0x5638b271ab52]
/home/mame/local/bin/ruby(vm_search_method_slowpath0+0x17) [0x5638b271af07]
/home/mame/local/bin/ruby(vm_exec_core+0x2731) [0x5638b2735801]
/home/mame/local/bin/ruby(rb_vm_exec+0xef) [0x5638b272447f]
/home/mame/local/bin/ruby(wmap_each_i+0x3d) [0x5638b2549e7d]
/home/mame/local/bin/ruby(rb_st_foreach+0x75) [0x5638b26a0cf5]
/home/mame/local/bin/ruby(wmap_each+0x3c) [0x5638b254408c]
/home/mame/local/bin/ruby(vm_call_cfunc_with_frame+0x137) [0x5638b2721ab7]
/home/mame/local/bin/ruby(vm_sendish.constprop.0+0xf5) [0x5638b271b195]
/home/mame/local/bin/ruby(vm_exec_core+0x182) [0x5638b2733252]
/home/mame/local/bin/ruby(rb_vm_exec+0xef) [0x5638b272447f]
/home/mame/local/bin/ruby(rb_ec_exec_node+0xb1) [0x5638b252fd61]
/home/mame/local/bin/ruby(ruby_run_node+0x4d) [0x5638b2534f1d]
/home/mame/local/bin/ruby(main+0x5f) [0x5638b252faef]
```

On my machine, it reproduces in Ruby 2.7, 3.0, 3.1, and master.

I think `ObjectSpace::WeakMap#each` is inherently very fragile because the elements may be GC'ed during iteration.



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

In This Thread

Prev Next