From: s.wanabe@... Date: 2017-06-11T16:23:19+00:00 Subject: [ruby-core:81650] [Ruby trunk Bug#13605] GC bug calling `ObjectSpace.each_object` Issue #13605 has been updated by wanabe (_ wanabe). It seems to be for lack of write-barrier. (as _ko1 suggested at [https://twitter.com/_ko1/status/871892183464370176](https://twitter.com/_ko1/status/871892183464370176)) The following script causes similar [BUG] about 50% of the time. ``` 10000.times do |i| v = rand(2000) name = "n#{v}" value = Object.new TOPLEVEL_BINDING.local_variable_set name, value end ``` It is helpful with "-DRGENGC_CHECK_MODE=2" build flag. I met following output: ``` verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055f470054578 [3LM ] T_IMEMO env -> 0x000055f4701cc770 [0 ] T_OBJECT (Object) verify_internal_consistency_reachable_i: WB miss (O->Y) 0x000055f470054758 [3LM ] T_IMEMO env -> 0x000055f470206920 [0 ] T_OBJECT (Object) (snip) a.rb:3: [BUG] gc_verify_internal_consistency: found internal inconsistency. ruby 2.5.0dev (2017-06-11 trunk 59060) [x86_64-linux] (snip) ``` ---------------------------------------- Bug #13605: GC bug calling `ObjectSpace.each_object` https://bugs.ruby-lang.org/issues/13605#change-65346 * Author: ryanf (Ryan Fitzgerald) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- This code made Ruby bail out with the message "[BUG] rb_gc_mark(): 0x000000040dc740 is T_NONE": ~~~ ruby ObjectSpace.each_object(Module){|m| next if (to_ignore.include?(m) rescue true) if m.respond_to?(:instance_methods) candidates.concat m.instance_methods(false).collect(&:to_s) end } ~~~ I haven't been able to repro, but it happened building Pry on Travis CI: https://travis-ci.org/pry/pry/jobs/236720971 The relevant logs are attached. ---Files-------------------------------- each_object_bug.txt (81.9 KB) patch-for-2508d68e.patch (8.07 KB) Dockerfile (353 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: