Skip to content

Commit dadc2ad

Browse files
authored
Fix sporadic failures testing with JRuby (#1012)
* Wait for blockers to proceed If this spec proceeds to reset the barrier before there are any waiters, the reset will not trigger them and the spec will fail. This at least tries to ensure that the waiter is there and will be interrupted as expected. * Bump join timeout up for slower system On slower or heavily-loaded systems, such as CI, this join may need more than one second. Give it ten before giving up and raising an error. * Use repeat_until_success to wait for waiters This avoids getting stuck and waiting forever if something goes awry. * Also skip on JRuby until we can fix sporadic failures
1 parent 42d2766 commit dadc2ad

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

spec/concurrent/atomic/cyclic_barrier_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module Concurrent
7171
end
7272

7373
start_latch.wait(1)
74+
repeat_until_success { expect(barrier.number_waiting).to eq 1 }
7475
barrier.reset
7576

7677
expect(barrier).not_to be_broken

spec/concurrent/edge/erlang_actor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@
918918
end
919919

920920
specify "timing out" do
921-
skip('flaky on truffleruby') if Concurrent.on_truffleruby?
921+
skip('flaky on truffleruby and jruby') if Concurrent.on_truffleruby? || Concurrent.on_jruby?
922922

923923
count_down = Concurrent::CountDownLatch.new
924924
body = { on_thread: -> { m = receive; count_down.wait; reply m },

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def requires=(paths)
5353
config.after :each do
5454
while defined?(@created_threads) && @created_threads && (thread = (@created_threads.pop(true) rescue nil))
5555
thread.kill
56-
thread_join = thread.join(1.0)
56+
thread_join = thread.join(10.0)
5757
expect(thread_join).not_to be_nil, thread.inspect
5858
end
5959
end

0 commit comments

Comments
 (0)