From 0783fd936602dfc0c04a91d22f95dd4a1fb21f3a Mon Sep 17 00:00:00 2001 From: normal Date: Thu, 16 Aug 2018 03:37:14 +0000 Subject: test/net/imap/test_imap.rb (test_exception_during_idle): kill infinite looper It is possible for Mutex#sleep (via ConditionVariable#wait) to prematurely wake up under MJIT (because Mutex#sleep can't handle spurious wakeups). This affects @idle_done_cond in Net::IMAP#idle and means the response handler may never set `in_idle' to `true`. In any case, ensure the infinite looping `raiser' thread stops running when the test is done. Will work on reducing the effect of spurious wakeups from MJIT... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/imap/test_imap.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 41f25fe1c7..936f4e0f42 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -231,7 +231,7 @@ class IMAPTest < Test::Unit::TestCase in_idle = false exception_raised = false c = m.new_cond - @threads << Thread.start do + raiser = Thread.start do m.synchronize do until in_idle c.wait(0.1) @@ -243,6 +243,7 @@ class IMAPTest < Test::Unit::TestCase c.signal end end + @threads << raiser imap.idle do |res| m.synchronize do in_idle = true @@ -260,6 +261,7 @@ class IMAPTest < Test::Unit::TestCase imap.logout ensure imap.disconnect if imap + raiser.kill unless in_idle end end -- cgit v1.2.3