Forum: Ruby-core [ruby-trunk - Bug #7304][Open] Random test failures around test_autoclose_true_closed_by_finalizer

Posted by Luis Lavena (luislavena)
on 2012-11-07 16:44
(Received via mailing list)
Issue #7304 has been reported by luislavena (Luis Lavena).

----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304

Author: luislavena (Luis Lavena)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: test
Target version: 2.0.0
ruby -v: ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Luis Lavena (luislavena)
on 2012-11-07 16:44
(Received via mailing list)
Issue #7304 has been updated by luislavena (Luis Lavena).

Status changed from Open to Assigned
ruby -v changed from ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) 
[i386-mingw32] to ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32572

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by h.shirosaki (Hiroshi Shirosaki) (Guest)
on 2012-11-08 10:27
(Received via mailing list)
Issue #7304 has been updated by h.shirosaki (Hiroshi Shirosaki).


=begin

I cannot reproduce above error. However, Bug #4168 and #5350 seem not 
solved.
I got NoMethodError by the following script. WeakRef object has 
reference to different object from originally associated.


 % cat test_weakref.rb
 require "weakref"

 class Foo
   def foo; end
 end

 a = []
 1000.times do
   a << WeakRef.new(Foo.new)
 end

 a.each do |x|
   begin
     x.foo
   rescue WeakRef::RefError
     p :referr
   end
 end

 % ruby -v test_weakref.rb
 ruby 2.0.0dev (2012-11-08 trunk 37558) [i686-linux]
 test_weakref.rb:14:in `block in <main>': undefined method `foo' for 
[70032780]:WeakRef (NoMethodError)
        from test_weakref.rb:12:in `each'
        from test_weakref.rb:12:in `<main>'
=end
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32626

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by h.shirosaki (Hiroshi Shirosaki) (Guest)
on 2012-11-09 10:33
(Received via mailing list)
Issue #7304 has been updated by h.shirosaki (Hiroshi Shirosaki).

File 0001-Fix-WeakRef-finalize.patch added

After some investigation, I found WeakRef finalize code appears wrong.
When finalize, object references were not removed from weakmap hash 
properly.

I attached a patch. I tested it with ruby 2.0.0dev (2012-11-09 trunk 
37558) [i686-linux].
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32701

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Luis Lavena (luislavena)
on 2012-11-10 17:14
(Received via mailing list)
Issue #7304 has been updated by luislavena (Luis Lavena).

Assignee changed from ko1 (Koichi Sasada) to authorNari (Narihiro 
Nakamura)
Priority changed from Normal to High

=begin
Thank you Shirosaki-san,

Applying the patch, it fixes the WeakRef issues.

 ruby -v: ruby 2.0.0dev (2012-11-10 trunk 37612) [i386-mingw32]
 3 tests, 4 assertions, 0 failures, 0 errors, 0 skips

Reassigning to Narihiro Nakamura, as the changes seems to be GC-related?

=end
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32756

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: authorNari (Narihiro Nakamura)
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Nobuyoshi Nakada (nobu)
on 2012-11-11 06:54
(Received via mailing list)
Issue #7304 has been updated by nobu (Nobuyoshi Nakada).

Category changed from test to core
Assignee changed from authorNari (Narihiro Nakamura) to h.shirosaki 
(Hiroshi Shirosaki)

Would you split the patch into refactor by renaming and the fix?
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32765

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: h.shirosaki (Hiroshi Shirosaki)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by h.shirosaki (Hiroshi Shirosaki) (Guest)
on 2012-11-11 12:23
(Received via mailing list)
Issue #7304 has been updated by h.shirosaki (Hiroshi Shirosaki).

Assignee changed from h.shirosaki (Hiroshi Shirosaki) to nobu (Nobuyoshi 
Nakada)

I've splited the patch into two commits and pushed it to github.

Could you check it? Thank you.
https://github.com/shirosaki/ruby/compare/trunk...weakref
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32776

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Luis Lavena (luislavena)
on 2012-11-14 23:23
(Received via mailing list)
Issue #7304 has been updated by luislavena (Luis Lavena).


Hello Nobu,

As pointed by Shirosaki-san, the two commits are now split.

Can we apply those changes to trunk? Who should be assigned to final 
approval?

Thank you

----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-32904

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Nobuyoshi Nakada (nobu)
on 2012-11-23 02:48
(Received via mailing list)
Issue #7304 has been updated by nobu (Nobuyoshi Nakada).


go ahead
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-33648

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by Luis Lavena (luislavena)
on 2012-11-23 20:08
(Received via mailing list)
Issue #7304 has been updated by luislavena (Luis Lavena).

Assignee changed from nobu (Nobuyoshi Nakada) to h.shirosaki (Hiroshi 
Shirosaki)

Thank you Nobu,

Hiroshi, Nobu give you green light to commit the changes from the 
branch.

Thank you both!
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-33665

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: h.shirosaki (Hiroshi Shirosaki)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Posted by h.shirosaki (Hiroshi Shirosaki) (Guest)
on 2012-11-24 12:30
(Received via mailing list)
Issue #7304 has been updated by h.shirosaki (Hiroshi Shirosaki).

Status changed from Closed to Assigned
% Done changed from 100 to 0

This fix causes segv, which was pointed out at r37831. Thank you, 
naruse-san.
I found rb_ary_delete(ary, obj) is not usable when doing WeakRef 
finalize because rb_ary_delete() calls rb_equal() against GC'ed WeakRef 
object.
Instead just comparing VALUE by '==' seems good for this case. I'll fix 
later.
----------------------------------------
Bug #7304: Random test failures around 
test_autoclose_true_closed_by_finalizer
https://bugs.ruby-lang.org/issues/7304#change-33813

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: High
Assignee: h.shirosaki (Hiroshi Shirosaki)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-07 trunk 37538) [i386-mingw32]


=begin
Hello,

Over the past few days I've seen on and off failures on RubyInstaller CI 
related to (({test_autoclose_true_closed_by_finalizer})):

http://ci.rubyinstaller.org/job/ruby-trunk-x86-tes...

 1) Error:
 test_autoclose_true_closed_by_finalizer(TestIO):
 NoMethodError: undefined method `close' for 2012-11-07 04:43:41 
-0300:WeakRef
 C:/Users/Worker/Jenkins/workspace/ruby-trunk-x86-build/test/ruby/test_io.rb:1611:in 
`test_autoclose_true_closed_by_finalizer'

This seems to happen when the system is under heavy load (because is 
running other jobs in parallel).

This might be a hint of something not working properly under heavy load, 
perhaps the GC in effect.

I was unable to produce the same failure on x64-mingw32, and haven't 
tried yet OSX or Linux.

Any ideas?
=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.