Fix SizedQueue#num_waiting regression#3597
Conversation
7824b91 to
892592b
Compare
|
Thanks for the nice spec! |
~/Projects/jruby [ ruby-2.3: ✗ ] 7d ⚡ bin/jruby spec/mspec/bin/mspec run spec/ruby/library/thread/sizedqueue/num_waiting_spec.rb 2.2.3 ☺
jruby 9.0.5.0-SNAPSHOT (2.3.0) 2016-01-19 badd94b Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 [darwin-x86_64]
1)
Thread::SizedQueue#num_waiting reports the number of threads waiting to push FAILED
Expected 0
to equal 1
/Users/kes/Projects/jruby/spec/ruby/library/thread/sizedqueue/num_waiting_spec.rb:12:in `block in (root)'
org/jruby/RubyBasicObject.java:1633:in `instance_eval'
org/jruby/RubyEnumerable.java:1562:in `all?'
org/jruby/RubyFixnum.java:296:in `times'
org/jruby/RubyArray.java:1555:in `each'
/Users/kes/Projects/jruby/spec/ruby/library/thread/sizedqueue/num_waiting_spec.rb:5:in `<top>'
org/jruby/RubyKernel.java:957:in `load'
org/jruby/RubyBasicObject.java:1633:in `instance_eval'
org/jruby/RubyArray.java:1555:in `each'
[\ | ==================100%================== | 00:00:00] 1F 0E
Finished in 0.015000 seconds
1 file, 2 examples, 6 expectations, 1 failure, 0 errors, 0 taggedSpec failed but I haven't made any further investigations yet. UPD: Seems that failure is related to race-condition issue. When I added |
Introduced in d13405b
892592b to
d54e4cd
Compare
|
I updated spec. P.S. Hope it's safe to wait until thread fall asleep. |
|
@thedarkone should be good to merge as is for JRuby 9.0.5 (non ruby-2.3), right? |
|
I'll look at merging this today. |
|
Note that https://github.com/spec/ruby has a different shared spec for I'll merge this into master for 9.0.5.0 but I'll leave it up to you folks to decide which spec is better. |
|
@headius I don't see any difference from existing shared spec https://github.com/jruby/jruby/blob/master/spec/ruby/library/thread/shared/queue/num_waiting.rb |
Introduced in d13405b.
JRuby 1.7 and MRI 2.2.3:
JRuby 9.0.4.0:
P.S. I'm not specialized in Java, but it seems to work.