From: shugo@... Date: 2015-10-29T02:09:54+00:00 Subject: [ruby-core:71258] [Ruby trunk - Bug #11384] multi-threaded autoload sometimes fails Issue #11384 has been updated by Shugo Maeda. Eric Wong wrote: > shugo@ruby-lang.org wrote: > > The script causes an error within 100 times on My Ubuntu 14.04 box, > > but it runs over 10,000 times with your patch. > > Is my patch still running beyond 10,000 times? It's still running beyond 49,000 times on my notebook, which sleeps at night. I'll inform you if any error occurs. ---------------------------------------- Bug #11384: multi-threaded autoload sometimes fails https://bugs.ruby-lang.org/issues/11384#change-54631 * Author: Eric Wong * Status: Closed * Priority: Normal * Assignee: * ruby -v: trunk r51319 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- ~~~ I get this failure once in a blue moon: #8 test_autoload.rb:46:in `': open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} autoload :ZZZ, "./zzz.rb" t1 = Thread.new {ZZZ.ok} t2 = Thread.new {ZZZ.ok} [t1.value, t2.value].join #=> "" (expected "okok") stderr output is not empty bootstraptest.tmp.rb:5:in `block in
': uninitialized constant ZZZ (Name +Error) test_autoload.rb FAIL 1/8 FAIL 1/1010 tests failed It is a very rare failure, I extracted it into a standalone script and it took over 500,000 runs to hit it: unless test(?e, "zzz.rb") open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} end autoload :ZZZ, "./zzz.rb" t1 = Thread.new {ZZZ.ok} t2 = Thread.new {ZZZ.ok} [t1.value, t2.value].join ~~~ I'll work on this when I find time, but maybe somebody else can look at it sooner. I'm not sure if it affects older versions. -- https://bugs.ruby-lang.org/