[#71439] [Ruby trunk - Feature #11339] [PATCH] io.c: avoid kwarg parsing in C API — matz@...
Issue #11339 has been updated by Yukihiro Matsumoto.
7 messages
2015/11/11
[#71473] Re: [Ruby trunk - Feature #11339] [PATCH] io.c: avoid kwarg parsing in C API
— Eric Wong <normalperson@...>
2015/11/13
Entire series for sockets
[#71450] Ruby 2.3.0-preview1 Released — "NARUSE, Yui" <naruse@...>
Hi,
5 messages
2015/11/11
[#71617] [Ruby trunk - Feature #11664] [PATCH] introduce rb_autoload_value to replace rb_autoload — nobu@...
Issue #11664 has been updated by Nobuyoshi Nakada.
3 messages
2015/11/20
[#71721] [Ruby trunk - Feature #11741] Migrate Ruby to Git from Subversion — me@...
Issue #11741 has been updated by Jon Moss.
4 messages
2015/11/28
[ruby-core:71501] [Ruby trunk - Bug #11683] multi-threaded autoload and defined? sometimes fails
From:
h.shirosaki@...
Date:
2015-11-16 04:23:52 UTC
List:
ruby-core #71501
Issue #11683 has been updated by Hiroshi Shirosaki.
If I add `sleep 0.01` in threads, the test more likely to fail on my Ubuntu 15.10 machine.
```ruby
require 'tempfile'
Tempfile.create(%w(autoload .rb)) do |file|
file.puts "class AutoloadTest; module B; end; end"
file.flush
autoload(:AutoloadTest, file.path)
begin
thrs = []
2.times do
thrs << Thread.new do
Thread.pass
sleep 0.01
unless "constant" == defined?(Object::AutoloadTest::B)
raise "defined? Object::AutoloadTest::B is not constant!"
end
end
end
thrs.each(&:join)
end
end
```
----------------------------------------
Bug #11683: multi-threaded autoload and defined? sometimes fails
https://bugs.ruby-lang.org/issues/11683#change-54865
* Author: Hiroshi Shirosaki
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.0dev (2015-11-13 trunk 52552) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
I get the following failure. This is a multi-threaded autoload and defined? method test.
If I add wait queue code introduced at r52332 to `rb_const_defined_0` function, the test is not failed.
I attached the patch.
```diff
diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb
index a672e0b..c71668e 100644
--- a/test/ruby/test_autoload.rb
+++ b/test/ruby/test_autoload.rb
@@ -234,6 +234,28 @@ p Foo::Bar
end
end
+ def test_defined_with_autoload
+ ruby_impl_require do |called_with|
+ Tempfile.create(%w(autoload .rb)) do |file|
+ file.puts "class AutoloadTest; module B; end; end"
+ file.flush
+ add_autoload(file.path)
+ begin
+ thrs = []
+ 2.times do
+ thrs << Thread.new do
+ Thread.pass; assert_equal("constant", defined? Object::AutoloadTest::B)
+ end
+ end
+ thrs.each(&:join)
+ ensure
+ remove_autoload_constant
+ end
+ assert_equal [file.path], called_with.uniq
+ end
+ end
+ end
+
def add_autoload(path)
(@autoload_paths ||= []) << path
::Object.class_eval {autoload(:AutoloadTest, path)}
```
```
$ while [ $? -eq 0 ]; do make test-all TESTS="-v ruby/test_autoload.rb -n test_defined_with_autoload"; done
(snip)
1) Failure:
TestAutoload#test_defined_with_autoload [/home/shirosaki/src/ruby/test/ruby/test_autoload.rb:247]:
<"constant"> expected but was
<nil>.
```
---Files--------------------------------
0001-Add-waiting-for-autoload-in-rb_const_defined_0.patch (2.63 KB)
--
https://bugs.ruby-lang.org/